Browse Source

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 years ago
parent
commit
f0a8282736
4 changed files with 51 additions and 9 deletions
  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 View File

858
 function toggleAudio() {
858
 function toggleAudio() {
859
     if (!(connection && connection.jingle.localAudio)) {
859
     if (!(connection && connection.jingle.localAudio)) {
860
         preMuted = true;
860
         preMuted = true;
861
+        // We still click the button.
862
+        buttonClick("#mute", "icon-microphone icon-mic-disabled");
861
         return;
863
         return;
862
     }
864
     }
863
 
865
 
866
         var audioEnabled = localAudio.getAudioTracks()[idx].enabled;
868
         var audioEnabled = localAudio.getAudioTracks()[idx].enabled;
867
 
869
 
868
         localAudio.getAudioTracks()[idx].enabled = !audioEnabled;
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
         connection.emuc.sendPresence();
873
         connection.emuc.sendPresence();
871
     }
874
     }
872
 
875
 
1569
     container.className = 'videocontainer';
1572
     container.className = 'videocontainer';
1570
     var remotes = document.getElementById('remoteVideos');
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
         addRemoteVideoMenu(peerJid, container);
1578
         addRemoteVideoMenu(peerJid, container);
1574
 
1579
 
1575
     remotes.appendChild(container);
1580
     remotes.appendChild(container);

+ 34
- 2
libs/prezi_player.js View File

6
 
6
 
7
         PreziPlayer.API_VERSION = 1;
7
         PreziPlayer.API_VERSION = 1;
8
         PreziPlayer.CURRENT_STEP = 'currentStep';
8
         PreziPlayer.CURRENT_STEP = 'currentStep';
9
+        PreziPlayer.CURRENT_ANIMATION_STEP = 'currentAnimationStep';
9
         PreziPlayer.CURRENT_OBJECT = 'currentObject';
10
         PreziPlayer.CURRENT_OBJECT = 'currentObject';
10
         PreziPlayer.STATUS_LOADING = 'loading';
11
         PreziPlayer.STATUS_LOADING = 'loading';
11
         PreziPlayer.STATUS_READY = 'ready';
12
         PreziPlayer.STATUS_READY = 'ready';
12
         PreziPlayer.STATUS_CONTENT_READY = 'contentready';
13
         PreziPlayer.STATUS_CONTENT_READY = 'contentready';
13
         PreziPlayer.EVENT_CURRENT_STEP = "currentStepChange";
14
         PreziPlayer.EVENT_CURRENT_STEP = "currentStepChange";
15
+        PreziPlayer.EVENT_CURRENT_ANIMATION_STEP = "currentAnimationStepChange";
14
         PreziPlayer.EVENT_CURRENT_OBJECT = "currentObjectChange";
16
         PreziPlayer.EVENT_CURRENT_OBJECT = "currentObjectChange";
15
         PreziPlayer.EVENT_STATUS = "statusChange";
17
         PreziPlayer.EVENT_STATUS = "statusChange";
16
         PreziPlayer.EVENT_PLAYING = "isAutoPlayingChange";
18
         PreziPlayer.EVENT_PLAYING = "isAutoPlayingChange";
61
             this.options = options;
63
             this.options = options;
62
             this.values = {'status': PreziPlayer.STATUS_LOADING};
64
             this.values = {'status': PreziPlayer.STATUS_LOADING};
63
             this.values[PreziPlayer.CURRENT_STEP] = 0;
65
             this.values[PreziPlayer.CURRENT_STEP] = 0;
66
+            this.values[PreziPlayer.CURRENT_ANIMATION_STEP] = 0;
64
             this.values[PreziPlayer.CURRENT_OBJECT] = null;
67
             this.values[PreziPlayer.CURRENT_OBJECT] = null;
65
             this.callbacks = [];
68
             this.callbacks = [];
66
             this.id = id;
69
             this.id = id;
84
             this.iframe.width = options.width || 640;
87
             this.iframe.width = options.width || 640;
85
             this.iframe.height = options.height || 480;
88
             this.iframe.height = options.height || 480;
86
             this.embedTo.innerHTML = '';
89
             this.embedTo.innerHTML = '';
90
+            // JITSI: IN CASE SOMETHING GOES WRONG.
87
             try {
91
             try {
88
                 this.embedTo.appendChild(this.iframe);
92
                 this.embedTo.appendChild(this.iframe);
89
             }
93
             }
90
             catch (err) {
94
             catch (err) {
91
                 console.log("CATCH ERROR");
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
             this.initPollInterval = setInterval(function(){
100
             this.initPollInterval = setInterval(function(){
96
                 _this.sendMessage({'action': 'init'});
101
                 _this.sendMessage({'action': 'init'});
97
             }, 500);
102
             }, 500);
152
         };
157
         };
153
 
158
 
154
         PreziPlayer.prototype.toStep = /* toStep is DEPRECATED */
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
             return this.sendMessage({
180
             return this.sendMessage({
157
                 'action': 'present',
181
                 'action': 'present',
158
                 'data': ['moveToStep', step]
182
                 'data': ['moveToStep', step]
192
             return this.values.currentStep;
216
             return this.values.currentStep;
193
         };
217
         };
194
 
218
 
219
+        PreziPlayer.prototype.getCurrentAnimationStep = function() {
220
+            return this.values.currentAnimationStep;
221
+        };
222
+
195
         PreziPlayer.prototype.getCurrentObject = function() {
223
         PreziPlayer.prototype.getCurrentObject = function() {
196
             return this.values.currentObject;
224
             return this.values.currentObject;
197
         };
225
         };
208
             return this.values.stepCount;
236
             return this.values.stepCount;
209
         };
237
         };
210
 
238
 
239
+        PreziPlayer.prototype.getAnimationCountOnSteps = function() {
240
+            return this.values.animationCountOnSteps;
241
+        };
242
+
211
         PreziPlayer.prototype.getTitle = function() {
243
         PreziPlayer.prototype.getTitle = function() {
212
             return this.values.title;
244
             return this.values.title;
213
         };
245
         };

+ 1
- 0
muc.js View File

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

+ 9
- 5
prezi.js View File

169
         console.log("presentation added", presUrl);
169
         console.log("presentation added", presUrl);
170
 
170
 
171
         var presId = getPresentationId(presUrl);
171
         var presId = getPresentationId(presUrl);
172
+
172
         var elementId = 'participant_'
173
         var elementId = 'participant_'
173
                         + Strophe.getResourceFromJid(jid)
174
                         + Strophe.getResourceFromJid(jid)
174
                         + '_' + presId;
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
         resizeThumbnails();
181
         resizeThumbnails();
178
 
182
 
179
         var controlsEnabled = false;
183
         var controlsEnabled = false;
322
      * Indicates presentation slide change.
326
      * Indicates presentation slide change.
323
      */
327
      */
324
     $(document).bind('gotoslide.muc', function (event, jid, presUrl, current) {
328
     $(document).bind('gotoslide.muc', function (event, jid, presUrl, current) {
325
-        if (preziPlayer) {
329
+        if (preziPlayer && preziPlayer.getCurrentStep() != current) {
326
             preziPlayer.flyToStep(current);
330
             preziPlayer.flyToStep(current);
327
-            // 
331
+
328
             var animationStepsArray = preziPlayer.getAnimationCountOnSteps();
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…
Cancel
Save