diff --git a/conference.js b/conference.js index b6b33d491..e48f28814 100644 --- a/conference.js +++ b/conference.js @@ -460,6 +460,18 @@ export default { return this._room && this._room.myUserId(); }, + /** + * Indicates if recording is supported in this conference. + */ + isRecordingSupported() { + return this._room && this._room.isRecordingSupported(); + }, + /** + * Returns the recording state or undefined if the room is not defined. + */ + getRecordingState() { + return (this._room) ? this._room.getRecordingState() : undefined; + }, /** * Will be filled with values only when config.debug is enabled. * Its used by torture to check audio levels. diff --git a/modules/UI/recording/Recording.js b/modules/UI/recording/Recording.js index 53e9ac949..9d1511ab2 100644 --- a/modules/UI/recording/Recording.js +++ b/modules/UI/recording/Recording.js @@ -30,7 +30,7 @@ import BottomToolbar from '../toolbars/BottomToolbar'; */ function _isRecordingButtonEnabled() { return interfaceConfig.TOOLBAR_BUTTONS.indexOf("recording") !== -1 - && config.enableRecording; + && config.enableRecording && APP.conference.isRecordingSupported(); } /** @@ -211,7 +211,7 @@ var Status = { /** * Manages the recording user interface and user experience. * @type {{init, initRecordingButton, showRecordingButton, updateRecordingState, - * setRecordingButtonState, checkAutoRecord}} + * updateRecordingUI, checkAutoRecord}} */ var Recording = { /** @@ -219,8 +219,8 @@ var Recording = { */ init (emitter, recordingType) { this.eventEmitter = emitter; - // Use recorder states directly from the library. - this.currentState = Status.UNAVAILABLE; + + this.updateRecordingState(APP.conference.getRecordingState()); this.initRecordingButton(recordingType); @@ -326,17 +326,17 @@ var Recording = { return; // If there's no state change, we ignore the update. - if (this.currentState === recordingState) + if (!recordingState || this.currentState === recordingState) return; - this.setRecordingButtonState(recordingState); + this.updateRecordingUI(recordingState); }, /** * Sets the state of the recording button. * @param recordingState gives us the current recording state */ - setRecordingButtonState (recordingState) { + updateRecordingUI (recordingState) { let buttonSelector = $('#toolbar_button_record'); let labelSelector = $('#recordingLabel');