Removes playerPaused variable and just use player to get its state.

This commit is contained in:
damencho 2016-04-26 10:22:12 +03:00
parent 3a9d743d47
commit 2442f0dfd3
1 changed files with 4 additions and 5 deletions

View File

@ -155,7 +155,6 @@ export default class SharedVideoManager {
window.onPlayerStateChange = function(event) {
if (event.data == YT.PlayerState.PLAYING) {
self.playerPaused = false;
self.player = event.target;
@ -164,14 +163,13 @@ export default class SharedVideoManager {
self.processAttributes(
self.player,
self.initialAttributes,
self.playerPaused);
false);
self.initialAttributes = null;
}
self.smartMute();
self.updateCheck();
} else if (event.data == YT.PlayerState.PAUSED) {
self.playerPaused = true;
self.smartUnmute();
self.updateCheck(true);
}
@ -372,7 +370,8 @@ export default class SharedVideoManager {
if(!this.player)
this.initialAttributes = attributes;
else {
this.processAttributes(this.player, attributes, this.playerPaused);
this.processAttributes(this.player, attributes,
(this.player.getPlayerState() === YT.PlayerState.PAUSED));
}
}
@ -446,7 +445,7 @@ export default class SharedVideoManager {
if (muted) {
this.mutedWithUserInteraction = userInteraction;
}
else if (!this.playerPaused) {
else if (this.player.getPlayerState() !== YT.PlayerState.PAUSED) {
this.mutePlayer(true);
}
}