1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-08 07:00:10 +02:00

fix: do a null check for tech when checking if we can toggle mute (#5857)

If the mute toggle checks whether mute can be set before the tech is ready, it may throw an error and cause issues. Instead, add a null check.
This commit is contained in:
marguinbc 2019-03-18 16:35:09 -04:00 committed by Gary Katsevman
parent c632b24364
commit d07f97dc94

View File

@ -101,7 +101,7 @@ class MuteToggle extends Button {
// in iOS when a player is loaded with muted attribute
// and volume is changed with a native mute button
// we want to make sure muted state is updated
if (browser.IS_IOS) {
if (browser.IS_IOS && this.player_.tech_ && this.player_.tech_.el_) {
this.player_.muted(this.player_.tech_.el_.muted);
}