Browse Source

Fixes pausing.

j8
damencho 9 years ago
parent
commit
a1ac18a632
1 changed files with 9 additions and 5 deletions
  1. 9
    5
      modules/UI/shared_video/SharedVideo.js

+ 9
- 5
modules/UI/shared_video/SharedVideo.js View File

101
                 self.updateCheck();
101
                 self.updateCheck();
102
             } else if (event.data == YT.PlayerState.PAUSED) {
102
             } else if (event.data == YT.PlayerState.PAUSED) {
103
                 self.playerPaused = true;
103
                 self.playerPaused = true;
104
-                self.updateCheck();
104
+                self.updateCheck(true);
105
             }
105
             }
106
         };
106
         };
107
 
107
 
146
     /**
146
     /**
147
      * Checks current state of the player and fire an event with the values.
147
      * Checks current state of the player and fire an event with the values.
148
      */
148
      */
149
-    updateCheck()
149
+    updateCheck(sendPauseEvent)
150
     {
150
     {
151
         // ignore update checks if we are not the owner of the video
151
         // ignore update checks if we are not the owner of the video
152
         if(!APP.conference.isLocalId(this.from))
152
         if(!APP.conference.isLocalId(this.from))
154
 
154
 
155
         let state = this.player.getPlayerState();
155
         let state = this.player.getPlayerState();
156
         // if its paused and haven't been pause - send paused
156
         // if its paused and haven't been pause - send paused
157
-        if (state === YT.PlayerState.PAUSED && !this.playerPaused) {
157
+        if (state === YT.PlayerState.PAUSED && sendPauseEvent) {
158
             this.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO,
158
             this.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO,
159
                 this.url, 'pause');
159
                 this.url, 'pause');
160
         }
160
         }
189
 
189
 
190
             // ocasionally we get this.player.getCurrentTime is not a function
190
             // ocasionally we get this.player.getCurrentTime is not a function
191
             // it seems its that player hasn't really loaded
191
             // it seems its that player hasn't really loaded
192
-            if(!this.player || !this.player.getCurrentTime)
192
+            if(!this.player || !this.player.getCurrentTime
193
+                || !this.player.pauseVideo
194
+                || !this.player.playVideo
195
+                || !this.player.getVolume
196
+                || !this.player.seekTo
197
+                || !this.player.getVolume)
193
                 return;
198
                 return;
194
 
199
 
195
             // check received time and current time
200
             // check received time and current time
211
                 console.log("Player change of volume:" + attributes.volume);
216
                 console.log("Player change of volume:" + attributes.volume);
212
             }
217
             }
213
 
218
 
214
-
215
             if(this.playerPaused)
219
             if(this.playerPaused)
216
                 this.player.playVideo();
220
                 this.player.playVideo();
217
         } else if (attributes.state == 'pause') {
221
         } else if (attributes.state == 'pause') {

Loading…
Cancel
Save