Adjusts recording button handling to the new focus(not finished).

pull/207/head
paweldomas 11 years ago
parent cd6264d0df
commit 0f6b6ae960
  1. 27
      recording.js
  2. 12
      toolbar.js

@ -1,9 +1,8 @@
/* global $, $iq, config, connection, focusJid, messageHandler, Moderator,
Toolbar, Util */
var Recording = (function (my) {
var status = false;
var recordingToken = null;
var recordingEnabled = false;
var recordingEnabled;
my.setRecordingToken = function (token) {
recordingToken = token;
@ -71,18 +70,36 @@ var Recording = (function (my) {
}
var oldState = recordingEnabled;
Toolbar.toggleRecordingButtonState();
Toolbar.setRecordingButtonState(!oldState);
my.setRecording(!oldState,
recordingToken,
function (state) {
console.log("New recording state: ", state);
if (state == oldState)
if (state === oldState)
{
// FIXME: new focus:
// this will not work when moderator changes
// during active session. Then it will assume that
// recording status has changed to true, but it might have
// been already true(and we only received actual status from
// the focus).
//
// SO we start with status null, so that it is initialized
// here and will fail only after second click, so if invalid
// token was used we have to press the button twice before
// current status will be fetched and token will be reset.
//
// Reliable way would be to return authentication error.
// Or status update when moderator connects.
// Or we have to stop recording session when current
// moderator leaves the room.
// Failed to change, reset the token because it might
// have been wrong
Toolbar.toggleRecordingButtonState();
my.setRecordingToken(null);
}
// Update with returned status
Toolbar.setRecordingButtonState(state);
}
);
};

@ -235,9 +235,15 @@ var Toolbar = (function (my) {
}
};
// Toggle the state of the recording button
my.toggleRecordingButtonState = function () {
$('#recordButton').toggleClass('active');
// Sets the state of the recording button
my.setRecordingButtonState = function (isRecording) {
if (isRecording) {
$('#recordButton').removeClass("icon-recEnable");
$('#recordButton').addClass("icon-recEnable active");
} else {
$('#recordButton').removeClass("icon-recEnable active");
$('#recordButton').addClass("icon-recEnable");
}
};
// Shows or hides SIP calls button

Loading…
Cancel
Save