Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

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

paweldomas0f6b6ae9607b
diff --git a/recording.js b/recording.js
index fffcfee92c..2961475a6f 100644
--- a/recording.js
+++ b/recording.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);
}
);
};
diff --git a/toolbar.js b/toolbar.js
index 8ccf727a40..d6972a4796 100644
--- a/toolbar.js
+++ b/toolbar.js
@@ -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