浏览代码

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

j8
damencho 9 年前
父节点
当前提交
2442f0dfd3
共有 1 个文件被更改,包括 4 次插入5 次删除
  1. 4
    5
      modules/UI/shared_video/SharedVideo.js

+ 4
- 5
modules/UI/shared_video/SharedVideo.js 查看文件

155
 
155
 
156
         window.onPlayerStateChange = function(event) {
156
         window.onPlayerStateChange = function(event) {
157
             if (event.data == YT.PlayerState.PLAYING) {
157
             if (event.data == YT.PlayerState.PLAYING) {
158
-                self.playerPaused = false;
159
 
158
 
160
                 self.player = event.target;
159
                 self.player = event.target;
161
 
160
 
164
                     self.processAttributes(
163
                     self.processAttributes(
165
                         self.player,
164
                         self.player,
166
                         self.initialAttributes,
165
                         self.initialAttributes,
167
-                        self.playerPaused);
166
+                        false);
168
 
167
 
169
                     self.initialAttributes = null;
168
                     self.initialAttributes = null;
170
                 }
169
                 }
171
                 self.smartMute();
170
                 self.smartMute();
172
                 self.updateCheck();
171
                 self.updateCheck();
173
             } else if (event.data == YT.PlayerState.PAUSED) {
172
             } else if (event.data == YT.PlayerState.PAUSED) {
174
-                self.playerPaused = true;
175
                 self.smartUnmute();
173
                 self.smartUnmute();
176
                 self.updateCheck(true);
174
                 self.updateCheck(true);
177
             }
175
             }
372
         if(!this.player)
370
         if(!this.player)
373
             this.initialAttributes = attributes;
371
             this.initialAttributes = attributes;
374
         else {
372
         else {
375
-            this.processAttributes(this.player, attributes, this.playerPaused);
373
+            this.processAttributes(this.player, attributes,
374
+                (this.player.getPlayerState() === YT.PlayerState.PAUSED));
376
         }
375
         }
377
     }
376
     }
378
 
377
 
446
         if (muted) {
445
         if (muted) {
447
             this.mutedWithUserInteraction = userInteraction;
446
             this.mutedWithUserInteraction = userInteraction;
448
         }
447
         }
449
-        else if (!this.playerPaused) {
448
+        else if (this.player.getPlayerState() !== YT.PlayerState.PAUSED) {
450
             this.mutePlayer(true);
449
             this.mutePlayer(true);
451
         }
450
         }
452
     }
451
     }

正在加载...
取消
保存