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,7 +101,7 @@ export default class SharedVideoManager {
101 101
                 self.updateCheck();
102 102
             } else if (event.data == YT.PlayerState.PAUSED) {
103 103
                 self.playerPaused = true;
104
-                self.updateCheck();
104
+                self.updateCheck(true);
105 105
             }
106 106
         };
107 107
 
@@ -146,7 +146,7 @@ export default class SharedVideoManager {
146 146
     /**
147 147
      * Checks current state of the player and fire an event with the values.
148 148
      */
149
-    updateCheck()
149
+    updateCheck(sendPauseEvent)
150 150
     {
151 151
         // ignore update checks if we are not the owner of the video
152 152
         if(!APP.conference.isLocalId(this.from))
@@ -154,7 +154,7 @@ export default class SharedVideoManager {
154 154
 
155 155
         let state = this.player.getPlayerState();
156 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 158
             this.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO,
159 159
                 this.url, 'pause');
160 160
         }
@@ -189,7 +189,12 @@ export default class SharedVideoManager {
189 189
 
190 190
             // ocasionally we get this.player.getCurrentTime is not a function
191 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 198
                 return;
194 199
 
195 200
             // check received time and current time
@@ -211,7 +216,6 @@ export default class SharedVideoManager {
211 216
                 console.log("Player change of volume:" + attributes.volume);
212 217
             }
213 218
 
214
-
215 219
             if(this.playerPaused)
216 220
                 this.player.playVideo();
217 221
         } else if (attributes.state == 'pause') {

Loading…
Cancel
Save