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).

This commit is contained in:
yanas 2014-05-30 17:18:32 +02:00
parent 3810aed345
commit f0a8282736
4 changed files with 51 additions and 9 deletions

9
app.js
View File

@ -858,6 +858,8 @@ function toggleVideo() {
function toggleAudio() {
if (!(connection && connection.jingle.localAudio)) {
preMuted = true;
// We still click the button.
buttonClick("#mute", "icon-microphone icon-mic-disabled");
return;
}
@ -866,7 +868,8 @@ function toggleAudio() {
var audioEnabled = localAudio.getAudioTracks()[idx].enabled;
localAudio.getAudioTracks()[idx].enabled = !audioEnabled;
connection.emuc.addAudioInfoToPresence(audioEnabled); //isMuted is the opposite of audioEnabled
// isMuted is the opposite of audioEnabled
connection.emuc.addAudioInfoToPresence(audioEnabled);
connection.emuc.sendPresence();
}
@ -1569,7 +1572,9 @@ function addRemoteVideoContainer(peerJid, spanId) {
container.className = 'videocontainer';
var remotes = document.getElementById('remoteVideos');
if (focus)
// If the peerJid is null then this video span couldn't be directly
// associated with a participant (this could happen in the case of prezi).
if (focus && peerJid != null)
addRemoteVideoMenu(peerJid, container);
remotes.appendChild(container);

View File

@ -6,11 +6,13 @@
PreziPlayer.API_VERSION = 1;
PreziPlayer.CURRENT_STEP = 'currentStep';
PreziPlayer.CURRENT_ANIMATION_STEP = 'currentAnimationStep';
PreziPlayer.CURRENT_OBJECT = 'currentObject';
PreziPlayer.STATUS_LOADING = 'loading';
PreziPlayer.STATUS_READY = 'ready';
PreziPlayer.STATUS_CONTENT_READY = 'contentready';
PreziPlayer.EVENT_CURRENT_STEP = "currentStepChange";
PreziPlayer.EVENT_CURRENT_ANIMATION_STEP = "currentAnimationStepChange";
PreziPlayer.EVENT_CURRENT_OBJECT = "currentObjectChange";
PreziPlayer.EVENT_STATUS = "statusChange";
PreziPlayer.EVENT_PLAYING = "isAutoPlayingChange";
@ -61,6 +63,7 @@
this.options = options;
this.values = {'status': PreziPlayer.STATUS_LOADING};
this.values[PreziPlayer.CURRENT_STEP] = 0;
this.values[PreziPlayer.CURRENT_ANIMATION_STEP] = 0;
this.values[PreziPlayer.CURRENT_OBJECT] = null;
this.callbacks = [];
this.id = id;
@ -84,14 +87,16 @@
this.iframe.width = options.width || 640;
this.iframe.height = options.height || 480;
this.embedTo.innerHTML = '';
// JITSI: IN CASE SOMETHING GOES WRONG.
try {
this.embedTo.appendChild(this.iframe);
}
catch (err) {
console.log("CATCH ERROR");
}
// JITSI: Increase interval from 200 to 500, which fixes prezi
// crashes for us.
this.initPollInterval = setInterval(function(){
_this.sendMessage({'action': 'init'});
}, 500);
@ -152,7 +157,26 @@
};
PreziPlayer.prototype.toStep = /* toStep is DEPRECATED */
PreziPlayer.prototype.flyToStep = function(step) {
PreziPlayer.prototype.flyToStep = function(step, animation_step) {
var obj = this;
// check animation_step
if (animation_step > 0 &&
obj.values.animationCountOnSteps &&
obj.values.animationCountOnSteps[step] <= animation_step) {
animation_step = obj.values.animationCountOnSteps[step];
}
// jump to animation steps by calling flyToNextStep()
function doAnimationSteps() {
if (obj.values.isMoving == true) {
setTimeout(doAnimationSteps, 100); // wait until the flight ends
return;
}
while (animation_step-- > 0) {
obj.flyToNextStep(); // do the animation steps
}
}
setTimeout(doAnimationSteps, 200); // 200ms is the internal "reporting" time
// jump to the step
return this.sendMessage({
'action': 'present',
'data': ['moveToStep', step]
@ -192,6 +216,10 @@
return this.values.currentStep;
};
PreziPlayer.prototype.getCurrentAnimationStep = function() {
return this.values.currentAnimationStep;
};
PreziPlayer.prototype.getCurrentObject = function() {
return this.values.currentObject;
};
@ -208,6 +236,10 @@
return this.values.stepCount;
};
PreziPlayer.prototype.getAnimationCountOnSteps = function() {
return this.values.animationCountOnSteps;
};
PreziPlayer.prototype.getTitle = function() {
return this.values.title;
};

1
muc.js
View File

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

View File

@ -169,11 +169,15 @@ var Prezi = (function (my) {
console.log("presentation added", presUrl);
var presId = getPresentationId(presUrl);
var elementId = 'participant_'
+ Strophe.getResourceFromJid(jid)
+ '_' + presId;
addRemoteVideoContainer(elementId);
// We explicitly don't specify the peer jid here, because we don't want
// this video to be dealt with as a peer related one (for example we
// don't want to show a mute/kick menu for this one, etc.).
addRemoteVideoContainer(null, elementId);
resizeThumbnails();
var controlsEnabled = false;
@ -322,12 +326,12 @@ var Prezi = (function (my) {
* Indicates presentation slide change.
*/
$(document).bind('gotoslide.muc', function (event, jid, presUrl, current) {
if (preziPlayer) {
if (preziPlayer && preziPlayer.getCurrentStep() != current) {
preziPlayer.flyToStep(current);
//
var animationStepsArray = preziPlayer.getAnimationCountOnSteps();
for (var i = 0; i <= animationStepsArray[current]; i++) {
preziPlayer.flyToNextStep();
for (var i = 0; i < parseInt(animationStepsArray[current]); i++) {
preziPlayer.flyToStep(current, i);
}
}
});