Просмотр исходного кода

Add hidden participant support

master
yanas 9 лет назад
Родитель
Сommit
c881e7b640

+ 4
- 1
conference.js Просмотреть файл

@@ -753,11 +753,14 @@ export default {
753 753
 
754 754
 
755 755
         room.on(ConferenceEvents.USER_JOINED, (id, user) => {
756
+            if (user.isHidden())
757
+                return;
758
+
756 759
             console.log('USER %s connnected', id, user);
757 760
             APP.API.notifyUserJoined(id);
758 761
             APP.UI.addUser(id, user.getDisplayName());
759 762
 
760
-            // chek the roles for the new user and reflect them
763
+            // check the roles for the new user and reflect them
761 764
             APP.UI.updateUserRole(user);
762 765
         });
763 766
         room.on(ConferenceEvents.USER_LEFT, (id, user) => {

+ 8
- 6
connection.js Просмотреть файл

@@ -132,15 +132,17 @@ function requestAuth() {
132 132
  */
133 133
 export function openConnection({id, password, retry, roomName}) {
134 134
 
135
-    let predefinedLogin = window.localStorage.getItem("xmpp_login");
136
-    let predefinedPassword = window.localStorage.getItem("xmpp_password");
135
+    let usernameOverride
136
+        = window.localStorage.getItem("xmpp_username_override");
137
+    let passwordOverride
138
+        = window.localStorage.getItem("xmpp_password_override");
137 139
 
138
-    if (!id && predefinedLogin && predefinedLogin.length > 0) {
139
-        id = predefinedLogin;
140
+    if (usernameOverride && usernameOverride.length > 0) {
141
+        id = usernameOverride;
140 142
     }
141 143
 
142
-    if (!password && predefinedPassword && predefinedPassword.length > 0) {
143
-        password = predefinedPassword;
144
+    if (passwordOverride && passwordOverride.length > 0) {
145
+        password = passwordOverride;
144 146
     }
145 147
 
146 148
     return connect(id, password, roomName).catch(function (err) {

+ 0
- 6
modules/UI/UI.js Просмотреть файл

@@ -29,7 +29,6 @@ var JitsiPopover = require("./util/JitsiPopover");
29 29
 var Feedback = require("./Feedback");
30 30
 
31 31
 import FollowMe from "../FollowMe";
32
-import Recorder from "../recorder/Recorder";
33 32
 
34 33
 var eventEmitter = new EventEmitter();
35 34
 UI.eventEmitter = eventEmitter;
@@ -242,11 +241,6 @@ UI.initConference = function () {
242 241
     //if local role changes buttons state will be again updated
243 242
     UI.updateLocalRole(false);
244 243
 
245
-    // Initialise the recorder handler. We're doing this explicitly before
246
-    // calling showToolbar, because the recorder may want to disable all
247
-    // toolbars.
248
-    new Recorder(APP.conference);
249
-
250 244
     // Once we've joined the muc show the toolbar
251 245
     ToolbarToggler.showToolbar();
252 246
 

+ 15
- 0
modules/UI/recording/Recording.js Просмотреть файл

@@ -16,6 +16,11 @@
16 16
  */
17 17
 import UIEvents from "../../../service/UI/UIEvents";
18 18
 import UIUtil from '../util/UIUtil';
19
+import VideoLayout from '../videolayout/VideoLayout';
20
+import Feedback from '../Feedback.js';
21
+import Toolbar from '../toolbars/Toolbar';
22
+import BottomToolbar from '../toolbars/BottomToolbar';
23
+
19 24
 
20 25
 /**
21 26
  * Indicates if the recording button should be enabled.
@@ -218,6 +223,16 @@ var Recording = {
218 223
         this.currentState = Status.UNAVAILABLE;
219 224
 
220 225
         this.initRecordingButton(recordingType);
226
+
227
+        // If I am a recorder then I publish my recorder custom role to notify
228
+        // everyone.
229
+        if (config.iAmRecorder) {
230
+            VideoLayout.enableDeviceAvailabilityIcons(
231
+                APP.conference.localId, true);
232
+            Feedback.enableFeedback(false);
233
+            Toolbar.enable(false);
234
+            BottomToolbar.enable(false);
235
+        }
221 236
     },
222 237
 
223 238
     /**

+ 8
- 2
modules/UI/videolayout/VideoLayout.js Просмотреть файл

@@ -277,7 +277,12 @@ var VideoLayout = {
277 277
 
278 278
     onRemoteStreamAdded (stream) {
279 279
         let id = stream.getParticipantId();
280
-        remoteVideos[id].addRemoteStreamElement(stream);
280
+        let remoteVideo = remoteVideos[id];
281
+
282
+        if (!remoteVideo)
283
+            return;
284
+
285
+        remoteVideo.addRemoteStreamElement(stream);
281 286
 
282 287
         // if track is muted make sure we reflect that
283 288
         if(stream.isMuted())
@@ -360,7 +365,8 @@ var VideoLayout = {
360 365
     },
361 366
 
362 367
     /**
363
-     * Creates a remote video for participant for the given id.
368
+     * Creates a participant container for the given id and smallVideo.
369
+     *
364 370
      * @param id the id of the participant to add
365 371
      * @param {SmallVideo} smallVideo optional small video instance to add as a
366 372
      * remote video, if undefined RemoteVideo will be created

+ 0
- 95
modules/recorder/Recorder.js Просмотреть файл

@@ -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;

Загрузка…
Отмена
Сохранить