浏览代码

Make sure we store initial attributes in order, so it will hold the last state we want to be in. Respects quick initial stop received.

j8
damencho 9 年前
父节点
当前提交
104503ee13
共有 3 个文件被更改,包括 17 次插入14 次删除
  1. 1
    1
      conference.js
  2. 1
    1
      modules/UI/UI.js
  3. 15
    12
      modules/UI/shared_video/SharedVideo.js

+ 1
- 1
conference.js 查看文件

1110
             Commands.SHARED_VIDEO, ({value, attributes}, id) => {
1110
             Commands.SHARED_VIDEO, ({value, attributes}, id) => {
1111
 
1111
 
1112
                 if (attributes.state === 'stop') {
1112
                 if (attributes.state === 'stop') {
1113
-                    APP.UI.stopSharedVideo(id);
1113
+                    APP.UI.stopSharedVideo(id, attributes);
1114
                 } else if (attributes.state === 'start') {
1114
                 } else if (attributes.state === 'start') {
1115
                     APP.UI.showSharedVideo(id, value, attributes);
1115
                     APP.UI.showSharedVideo(id, value, attributes);
1116
                 } else if (attributes.state === 'playing'
1116
                 } else if (attributes.state === 'playing'

+ 1
- 1
modules/UI/UI.js 查看文件

1115
  */
1115
  */
1116
 UI.stopSharedVideo = function (id, attributes) {
1116
 UI.stopSharedVideo = function (id, attributes) {
1117
     if (sharedVideoManager)
1117
     if (sharedVideoManager)
1118
-        sharedVideoManager.stopSharedVideo(id);
1118
+        sharedVideoManager.stopSharedVideo(id, attributes);
1119
 };
1119
 };
1120
 
1120
 
1121
 module.exports = UI;
1121
 module.exports = UI;

+ 15
- 12
modules/UI/shared_video/SharedVideo.js 查看文件

44
 
44
 
45
         if(APP.conference.isLocalId(this.from)) {
45
         if(APP.conference.isLocalId(this.from)) {
46
             showStopVideoPropmpt().then(() =>
46
             showStopVideoPropmpt().then(() =>
47
-                this.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO, null, 'stop'));
47
+                this.emitter.emit(
48
+                    UIEvents.UPDATE_SHARED_VIDEO, this.url, 'stop'));
48
         } else {
49
         } else {
49
             messageHandler.openMessageDialog(
50
             messageHandler.openMessageDialog(
50
                 "dialog.shareVideoTitle",
51
                 "dialog.shareVideoTitle",
84
         // we need to operate with player after start playing
85
         // we need to operate with player after start playing
85
         // self.player will be defined once it start playing
86
         // self.player will be defined once it start playing
86
         // and will process any initial attributes if any
87
         // and will process any initial attributes if any
87
-        this.initialAttributes = null;
88
+        this.initialAttributes = attributes;
88
 
89
 
89
         var self = this;
90
         var self = this;
90
         if(self.isPlayerAPILoaded)
91
         if(self.isPlayerAPILoaded)
157
                     self.updateCheck.bind(self),
158
                     self.updateCheck.bind(self),
158
                     updateInterval);
159
                     updateInterval);
159
             }
160
             }
160
-
161
-            if(self.player)
162
-                self.processAttributes(
163
-                    self.player, attributes, self.playerPaused);
164
-            else {
165
-                self.initialAttributes = attributes;
166
-            }
167
         };
161
         };
168
 
162
 
169
         window.onPlayerError = function(event) {
163
         window.onPlayerError = function(event) {
201
             player.pauseVideo();
195
             player.pauseVideo();
202
 
196
 
203
             this.processTime(player, attributes, !playerPaused);
197
             this.processTime(player, attributes, !playerPaused);
198
+        } else if (attributes.state == 'stop') {
199
+            this.stopSharedVideo(this.from);
204
         }
200
         }
205
     }
201
     }
206
 
202
 
236
     updateCheck(sendPauseEvent)
232
     updateCheck(sendPauseEvent)
237
     {
233
     {
238
         // ignore update checks if we are not the owner of the video
234
         // ignore update checks if we are not the owner of the video
239
-        // or there is still no player defined
240
-        if(!APP.conference.isLocalId(this.from) || !this.player)
235
+        // or there is still no player defined or we are stopped
236
+        // (in a process of stopping)
237
+        if(!APP.conference.isLocalId(this.from) || !this.player
238
+            || !this.isSharedVideoShown)
241
             return;
239
             return;
242
 
240
 
243
         let state = this.player.getPlayerState();
241
         let state = this.player.getPlayerState();
287
      * left and we want to remove video if the user sharing it left).
285
      * left and we want to remove video if the user sharing it left).
288
      * @param id the id of the sender of the command
286
      * @param id the id of the sender of the command
289
      */
287
      */
290
-    stopSharedVideo (id) {
288
+    stopSharedVideo (id, attributes) {
291
         if (!this.isSharedVideoShown)
289
         if (!this.isSharedVideoShown)
292
             return;
290
             return;
293
 
291
 
294
         if(this.from !== id)
292
         if(this.from !== id)
295
             return;
293
             return;
296
 
294
 
295
+        if(!this.player){
296
+            this.initialAttributes = attributes;
297
+            return;
298
+        }
299
+
297
         if(this.intervalId) {
300
         if(this.intervalId) {
298
             clearInterval(this.intervalId);
301
             clearInterval(this.intervalId);
299
             this.intervalId = null;
302
             this.intervalId = null;

正在加载...
取消
保存