|
@@ -1,95 +0,0 @@
|
1
|
|
-/* global config, APP */
|
2
|
|
-/*
|
3
|
|
- * Copyright @ 2015 Atlassian Pty Ltd
|
4
|
|
- *
|
5
|
|
- * Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
|
- * you may not use this file except in compliance with the License.
|
7
|
|
- * You may obtain a copy of the License at
|
8
|
|
- *
|
9
|
|
- * http://www.apache.org/licenses/LICENSE-2.0
|
10
|
|
- *
|
11
|
|
- * Unless required by applicable law or agreed to in writing, software
|
12
|
|
- * distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
|
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
|
- * See the License for the specific language governing permissions and
|
15
|
|
- * limitations under the License.
|
16
|
|
- */
|
17
|
|
-import VideoLayout from '../UI/videolayout/VideoLayout';
|
18
|
|
-import Feedback from '../UI/Feedback.js';
|
19
|
|
-import Toolbar from '../UI/toolbars/Toolbar';
|
20
|
|
-import BottomToolbar from '../UI/toolbars/BottomToolbar';
|
21
|
|
-
|
22
|
|
-const _RECORDER_CUSTOM_ROLE = "recorder-role";
|
23
|
|
-
|
24
|
|
-class Recorder {
|
25
|
|
- /**
|
26
|
|
- * Initializes a new {Recorder} instance.
|
27
|
|
- *
|
28
|
|
- * @param conference the {conference} which is to transport
|
29
|
|
- * {Recorder}-related information between participants
|
30
|
|
- */
|
31
|
|
- constructor (conference) {
|
32
|
|
- this._conference = conference;
|
33
|
|
-
|
34
|
|
- // If I am a recorder then I publish my recorder custom role to notify
|
35
|
|
- // everyone.
|
36
|
|
- if (config.iAmRecorder) {
|
37
|
|
- VideoLayout.enableDeviceAvailabilityIcons(conference.localId, true);
|
38
|
|
- this._publishMyRecorderRole();
|
39
|
|
- Feedback.enableFeedback(false);
|
40
|
|
- Toolbar.enable(false);
|
41
|
|
- BottomToolbar.enable(false);
|
42
|
|
- }
|
43
|
|
-
|
44
|
|
- // Listen to "CUSTOM_ROLE" commands.
|
45
|
|
- this._conference.commands.addCommandListener(
|
46
|
|
- this._conference.commands.defaults.CUSTOM_ROLE,
|
47
|
|
- this._onCustomRoleCommand.bind(this));
|
48
|
|
- }
|
49
|
|
-
|
50
|
|
- /**
|
51
|
|
- * Publish the recorder custom role.
|
52
|
|
- * @private
|
53
|
|
- */
|
54
|
|
- _publishMyRecorderRole () {
|
55
|
|
- var conference = this._conference;
|
56
|
|
-
|
57
|
|
- var commands = conference.commands;
|
58
|
|
-
|
59
|
|
- commands.removeCommand(commands.defaults.CUSTOM_ROLE);
|
60
|
|
- var self = this;
|
61
|
|
- commands.sendCommandOnce(
|
62
|
|
- commands.defaults.CUSTOM_ROLE,
|
63
|
|
- {
|
64
|
|
- attributes: {
|
65
|
|
- recorderRole: true
|
66
|
|
- }
|
67
|
|
- });
|
68
|
|
- }
|
69
|
|
-
|
70
|
|
- /**
|
71
|
|
- * Notifies this instance about a &qout;Custom Role&qout; command (delivered
|
72
|
|
- * by the Command(s) API of {this._conference}).
|
73
|
|
- *
|
74
|
|
- * @param attributes the attributes {Object} carried by the command
|
75
|
|
- * @param id the identifier of the participant who issued the command. A
|
76
|
|
- * notable idiosyncrasy of the Command(s) API to be mindful of here is that
|
77
|
|
- * the command may be issued by the local participant.
|
78
|
|
- */
|
79
|
|
- _onCustomRoleCommand ({ attributes }, id) {
|
80
|
|
- // We require to know who issued the command because (1) only a
|
81
|
|
- // moderator is allowed to send commands and (2) a command MUST be
|
82
|
|
- // issued by a defined commander.
|
83
|
|
- if (typeof id === 'undefined'
|
84
|
|
- || this._conference.isLocalId(id)
|
85
|
|
- || !attributes.recorderRole)
|
86
|
|
- return;
|
87
|
|
-
|
88
|
|
- var isRecorder = (attributes.recorderRole == 'true');
|
89
|
|
-
|
90
|
|
- if (isRecorder)
|
91
|
|
- VideoLayout.enableDeviceAvailabilityIcons(id, isRecorder);
|
92
|
|
- }
|
93
|
|
-}
|
94
|
|
-
|
95
|
|
-export default Recorder;
|