瀏覽代碼

Fixes some problems related to adding a prezi to the conference. Updates the Prezi Player and fixes some issues caused by commit 76c0485e (Skip animation steps).

j8
yanas 11 年之前
父節點
當前提交
f0a8282736
共有 4 個文件被更改,包括 51 次插入9 次删除
  1. 7
    2
      app.js
  2. 34
    2
      libs/prezi_player.js
  3. 1
    0
      muc.js
  4. 9
    5
      prezi.js

+ 7
- 2
app.js 查看文件

@@ -858,6 +858,8 @@ function toggleVideo() {
858 858
 function toggleAudio() {
859 859
     if (!(connection && connection.jingle.localAudio)) {
860 860
         preMuted = true;
861
+        // We still click the button.
862
+        buttonClick("#mute", "icon-microphone icon-mic-disabled");
861 863
         return;
862 864
     }
863 865
 
@@ -866,7 +868,8 @@ function toggleAudio() {
866 868
         var audioEnabled = localAudio.getAudioTracks()[idx].enabled;
867 869
 
868 870
         localAudio.getAudioTracks()[idx].enabled = !audioEnabled;
869
-        connection.emuc.addAudioInfoToPresence(audioEnabled); //isMuted is the opposite of audioEnabled
871
+        // isMuted is the opposite of audioEnabled
872
+        connection.emuc.addAudioInfoToPresence(audioEnabled);
870 873
         connection.emuc.sendPresence();
871 874
     }
872 875
 
@@ -1569,7 +1572,9 @@ function addRemoteVideoContainer(peerJid, spanId) {
1569 1572
     container.className = 'videocontainer';
1570 1573
     var remotes = document.getElementById('remoteVideos');
1571 1574
 
1572
-    if (focus)
1575
+    // If the peerJid is null then this video span couldn't be directly
1576
+    // associated with a participant (this could happen in the case of prezi).
1577
+    if (focus && peerJid != null)
1573 1578
         addRemoteVideoMenu(peerJid, container);
1574 1579
 
1575 1580
     remotes.appendChild(container);

+ 34
- 2
libs/prezi_player.js 查看文件

@@ -6,11 +6,13 @@
6 6
 
7 7
         PreziPlayer.API_VERSION = 1;
8 8
         PreziPlayer.CURRENT_STEP = 'currentStep';
9
+        PreziPlayer.CURRENT_ANIMATION_STEP = 'currentAnimationStep';
9 10
         PreziPlayer.CURRENT_OBJECT = 'currentObject';
10 11
         PreziPlayer.STATUS_LOADING = 'loading';
11 12
         PreziPlayer.STATUS_READY = 'ready';
12 13
         PreziPlayer.STATUS_CONTENT_READY = 'contentready';
13 14
         PreziPlayer.EVENT_CURRENT_STEP = "currentStepChange";
15
+        PreziPlayer.EVENT_CURRENT_ANIMATION_STEP = "currentAnimationStepChange";
14 16
         PreziPlayer.EVENT_CURRENT_OBJECT = "currentObjectChange";
15 17
         PreziPlayer.EVENT_STATUS = "statusChange";
16 18
         PreziPlayer.EVENT_PLAYING = "isAutoPlayingChange";
@@ -61,6 +63,7 @@
61 63
             this.options = options;
62 64
             this.values = {'status': PreziPlayer.STATUS_LOADING};
63 65
             this.values[PreziPlayer.CURRENT_STEP] = 0;
66
+            this.values[PreziPlayer.CURRENT_ANIMATION_STEP] = 0;
64 67
             this.values[PreziPlayer.CURRENT_OBJECT] = null;
65 68
             this.callbacks = [];
66 69
             this.id = id;
@@ -84,14 +87,16 @@
84 87
             this.iframe.width = options.width || 640;
85 88
             this.iframe.height = options.height || 480;
86 89
             this.embedTo.innerHTML = '';
90
+            // JITSI: IN CASE SOMETHING GOES WRONG.
87 91
             try {
88 92
                 this.embedTo.appendChild(this.iframe);
89 93
             }
90 94
             catch (err) {
91 95
                 console.log("CATCH ERROR");
92 96
             }
93
-                          
94 97
 
98
+            // JITSI: Increase interval from 200 to 500, which fixes prezi
99
+            // crashes for us.
95 100
             this.initPollInterval = setInterval(function(){
96 101
                 _this.sendMessage({'action': 'init'});
97 102
             }, 500);
@@ -152,7 +157,26 @@
152 157
         };
153 158
 
154 159
         PreziPlayer.prototype.toStep = /* toStep is DEPRECATED */
155
-        PreziPlayer.prototype.flyToStep = function(step) {
160
+        PreziPlayer.prototype.flyToStep = function(step, animation_step) {
161
+            var obj = this;
162
+            // check animation_step
163
+            if (animation_step > 0 &&
164
+                obj.values.animationCountOnSteps &&
165
+                obj.values.animationCountOnSteps[step] <= animation_step) {
166
+                animation_step = obj.values.animationCountOnSteps[step];
167
+            }
168
+            // jump to animation steps by calling flyToNextStep()
169
+            function doAnimationSteps() {
170
+                if (obj.values.isMoving == true) {
171
+                    setTimeout(doAnimationSteps, 100); // wait until the flight ends
172
+                    return;
173
+                }
174
+                while (animation_step-- > 0) {
175
+                    obj.flyToNextStep(); // do the animation steps
176
+                }
177
+            }
178
+            setTimeout(doAnimationSteps, 200); // 200ms is the internal "reporting" time
179
+            // jump to the step
156 180
             return this.sendMessage({
157 181
                 'action': 'present',
158 182
                 'data': ['moveToStep', step]
@@ -192,6 +216,10 @@
192 216
             return this.values.currentStep;
193 217
         };
194 218
 
219
+        PreziPlayer.prototype.getCurrentAnimationStep = function() {
220
+            return this.values.currentAnimationStep;
221
+        };
222
+
195 223
         PreziPlayer.prototype.getCurrentObject = function() {
196 224
             return this.values.currentObject;
197 225
         };
@@ -208,6 +236,10 @@
208 236
             return this.values.stepCount;
209 237
         };
210 238
 
239
+        PreziPlayer.prototype.getAnimationCountOnSteps = function() {
240
+            return this.values.animationCountOnSteps;
241
+        };
242
+
211 243
         PreziPlayer.prototype.getTitle = function() {
212 244
             return this.values.title;
213 245
         };

+ 1
- 0
muc.js 查看文件

@@ -61,6 +61,7 @@ Strophe.addConnectionPlugin('emuc', {
61 61
         {
62 62
             var url = presentation.attr('url');
63 63
             var current = presentation.find('>current').text();
64
+
64 65
             console.log('presentation info received from', from, url);
65 66
 
66 67
             if (this.preziMap[from] == null) {

+ 9
- 5
prezi.js 查看文件

@@ -169,11 +169,15 @@ var Prezi = (function (my) {
169 169
         console.log("presentation added", presUrl);
170 170
 
171 171
         var presId = getPresentationId(presUrl);
172
+
172 173
         var elementId = 'participant_'
173 174
                         + Strophe.getResourceFromJid(jid)
174 175
                         + '_' + presId;
175 176
 
176
-        addRemoteVideoContainer(elementId);
177
+        // We explicitly don't specify the peer jid here, because we don't want
178
+        // this video to be dealt with as a peer related one (for example we
179
+        // don't want to show a mute/kick menu for this one, etc.).
180
+        addRemoteVideoContainer(null, elementId);
177 181
         resizeThumbnails();
178 182
 
179 183
         var controlsEnabled = false;
@@ -322,12 +326,12 @@ var Prezi = (function (my) {
322 326
      * Indicates presentation slide change.
323 327
      */
324 328
     $(document).bind('gotoslide.muc', function (event, jid, presUrl, current) {
325
-        if (preziPlayer) {
329
+        if (preziPlayer && preziPlayer.getCurrentStep() != current) {
326 330
             preziPlayer.flyToStep(current);
327
-            // 
331
+
328 332
             var animationStepsArray = preziPlayer.getAnimationCountOnSteps();
329
-            for (var i = 0; i <= animationStepsArray[current]; i++) {
330
-                preziPlayer.flyToNextStep();
333
+            for (var i = 0; i < parseInt(animationStepsArray[current]); i++) {
334
+                preziPlayer.flyToStep(current, i);
331 335
             }
332 336
         }
333 337
     });

Loading…
取消
儲存