Merge pull request #628 from jitsi/add-hidden-participant-support
Add hidden participant support
This commit is contained in:
commit
81a487b856
|
@ -745,11 +745,14 @@ export default {
|
||||||
|
|
||||||
|
|
||||||
room.on(ConferenceEvents.USER_JOINED, (id, user) => {
|
room.on(ConferenceEvents.USER_JOINED, (id, user) => {
|
||||||
|
if (user.isHidden())
|
||||||
|
return;
|
||||||
|
|
||||||
console.log('USER %s connnected', id, user);
|
console.log('USER %s connnected', id, user);
|
||||||
APP.API.notifyUserJoined(id);
|
APP.API.notifyUserJoined(id);
|
||||||
APP.UI.addUser(id, user.getDisplayName());
|
APP.UI.addUser(id, user.getDisplayName());
|
||||||
|
|
||||||
// chek the roles for the new user and reflect them
|
// check the roles for the new user and reflect them
|
||||||
APP.UI.updateUserRole(user);
|
APP.UI.updateUserRole(user);
|
||||||
});
|
});
|
||||||
room.on(ConferenceEvents.USER_LEFT, (id, user) => {
|
room.on(ConferenceEvents.USER_LEFT, (id, user) => {
|
||||||
|
|
|
@ -132,15 +132,17 @@ function requestAuth() {
|
||||||
*/
|
*/
|
||||||
export function openConnection({id, password, retry, roomName}) {
|
export function openConnection({id, password, retry, roomName}) {
|
||||||
|
|
||||||
let predefinedLogin = window.localStorage.getItem("xmpp_login");
|
let usernameOverride
|
||||||
let predefinedPassword = window.localStorage.getItem("xmpp_password");
|
= window.localStorage.getItem("xmpp_username_override");
|
||||||
|
let passwordOverride
|
||||||
|
= window.localStorage.getItem("xmpp_password_override");
|
||||||
|
|
||||||
if (!id && predefinedLogin && predefinedLogin.length > 0) {
|
if (usernameOverride && usernameOverride.length > 0) {
|
||||||
id = predefinedLogin;
|
id = usernameOverride;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!password && predefinedPassword && predefinedPassword.length > 0) {
|
if (passwordOverride && passwordOverride.length > 0) {
|
||||||
password = predefinedPassword;
|
password = passwordOverride;
|
||||||
}
|
}
|
||||||
|
|
||||||
return connect(id, password, roomName).catch(function (err) {
|
return connect(id, password, roomName).catch(function (err) {
|
||||||
|
|
|
@ -29,7 +29,6 @@ var JitsiPopover = require("./util/JitsiPopover");
|
||||||
var Feedback = require("./Feedback");
|
var Feedback = require("./Feedback");
|
||||||
|
|
||||||
import FollowMe from "../FollowMe";
|
import FollowMe from "../FollowMe";
|
||||||
import Recorder from "../recorder/Recorder";
|
|
||||||
|
|
||||||
var eventEmitter = new EventEmitter();
|
var eventEmitter = new EventEmitter();
|
||||||
UI.eventEmitter = eventEmitter;
|
UI.eventEmitter = eventEmitter;
|
||||||
|
@ -242,11 +241,6 @@ UI.initConference = function () {
|
||||||
//if local role changes buttons state will be again updated
|
//if local role changes buttons state will be again updated
|
||||||
UI.updateLocalRole(false);
|
UI.updateLocalRole(false);
|
||||||
|
|
||||||
// Initialise the recorder handler. We're doing this explicitly before
|
|
||||||
// calling showToolbar, because the recorder may want to disable all
|
|
||||||
// toolbars.
|
|
||||||
new Recorder(APP.conference);
|
|
||||||
|
|
||||||
// Once we've joined the muc show the toolbar
|
// Once we've joined the muc show the toolbar
|
||||||
ToolbarToggler.showToolbar();
|
ToolbarToggler.showToolbar();
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,11 @@
|
||||||
*/
|
*/
|
||||||
import UIEvents from "../../../service/UI/UIEvents";
|
import UIEvents from "../../../service/UI/UIEvents";
|
||||||
import UIUtil from '../util/UIUtil';
|
import UIUtil from '../util/UIUtil';
|
||||||
|
import VideoLayout from '../videolayout/VideoLayout';
|
||||||
|
import Feedback from '../Feedback.js';
|
||||||
|
import Toolbar from '../toolbars/Toolbar';
|
||||||
|
import BottomToolbar from '../toolbars/BottomToolbar';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if the recording button should be enabled.
|
* Indicates if the recording button should be enabled.
|
||||||
|
@ -218,6 +223,16 @@ var Recording = {
|
||||||
this.currentState = Status.UNAVAILABLE;
|
this.currentState = Status.UNAVAILABLE;
|
||||||
|
|
||||||
this.initRecordingButton(recordingType);
|
this.initRecordingButton(recordingType);
|
||||||
|
|
||||||
|
// If I am a recorder then I publish my recorder custom role to notify
|
||||||
|
// everyone.
|
||||||
|
if (config.iAmRecorder) {
|
||||||
|
VideoLayout.enableDeviceAvailabilityIcons(
|
||||||
|
APP.conference.localId, true);
|
||||||
|
Feedback.enableFeedback(false);
|
||||||
|
Toolbar.enable(false);
|
||||||
|
BottomToolbar.enable(false);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -277,7 +277,12 @@ var VideoLayout = {
|
||||||
|
|
||||||
onRemoteStreamAdded (stream) {
|
onRemoteStreamAdded (stream) {
|
||||||
let id = stream.getParticipantId();
|
let id = stream.getParticipantId();
|
||||||
remoteVideos[id].addRemoteStreamElement(stream);
|
let remoteVideo = remoteVideos[id];
|
||||||
|
|
||||||
|
if (!remoteVideo)
|
||||||
|
return;
|
||||||
|
|
||||||
|
remoteVideo.addRemoteStreamElement(stream);
|
||||||
|
|
||||||
// if track is muted make sure we reflect that
|
// if track is muted make sure we reflect that
|
||||||
if(stream.isMuted())
|
if(stream.isMuted())
|
||||||
|
@ -360,7 +365,8 @@ var VideoLayout = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a remote video for participant for the given id.
|
* Creates a participant container for the given id and smallVideo.
|
||||||
|
*
|
||||||
* @param id the id of the participant to add
|
* @param id the id of the participant to add
|
||||||
* @param {SmallVideo} smallVideo optional small video instance to add as a
|
* @param {SmallVideo} smallVideo optional small video instance to add as a
|
||||||
* remote video, if undefined RemoteVideo will be created
|
* remote video, if undefined RemoteVideo will be created
|
||||||
|
|
|
@ -1,95 +0,0 @@
|
||||||
/* global config, APP */
|
|
||||||
/*
|
|
||||||
* Copyright @ 2015 Atlassian Pty Ltd
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
import VideoLayout from '../UI/videolayout/VideoLayout';
|
|
||||||
import Feedback from '../UI/Feedback.js';
|
|
||||||
import Toolbar from '../UI/toolbars/Toolbar';
|
|
||||||
import BottomToolbar from '../UI/toolbars/BottomToolbar';
|
|
||||||
|
|
||||||
const _RECORDER_CUSTOM_ROLE = "recorder-role";
|
|
||||||
|
|
||||||
class Recorder {
|
|
||||||
/**
|
|
||||||
* Initializes a new {Recorder} instance.
|
|
||||||
*
|
|
||||||
* @param conference the {conference} which is to transport
|
|
||||||
* {Recorder}-related information between participants
|
|
||||||
*/
|
|
||||||
constructor (conference) {
|
|
||||||
this._conference = conference;
|
|
||||||
|
|
||||||
// If I am a recorder then I publish my recorder custom role to notify
|
|
||||||
// everyone.
|
|
||||||
if (config.iAmRecorder) {
|
|
||||||
VideoLayout.enableDeviceAvailabilityIcons(conference.localId, true);
|
|
||||||
this._publishMyRecorderRole();
|
|
||||||
Feedback.enableFeedback(false);
|
|
||||||
Toolbar.enable(false);
|
|
||||||
BottomToolbar.enable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Listen to "CUSTOM_ROLE" commands.
|
|
||||||
this._conference.commands.addCommandListener(
|
|
||||||
this._conference.commands.defaults.CUSTOM_ROLE,
|
|
||||||
this._onCustomRoleCommand.bind(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Publish the recorder custom role.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_publishMyRecorderRole () {
|
|
||||||
var conference = this._conference;
|
|
||||||
|
|
||||||
var commands = conference.commands;
|
|
||||||
|
|
||||||
commands.removeCommand(commands.defaults.CUSTOM_ROLE);
|
|
||||||
var self = this;
|
|
||||||
commands.sendCommandOnce(
|
|
||||||
commands.defaults.CUSTOM_ROLE,
|
|
||||||
{
|
|
||||||
attributes: {
|
|
||||||
recorderRole: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies this instance about a &qout;Custom Role&qout; command (delivered
|
|
||||||
* by the Command(s) API of {this._conference}).
|
|
||||||
*
|
|
||||||
* @param attributes the attributes {Object} carried by the command
|
|
||||||
* @param id the identifier of the participant who issued the command. A
|
|
||||||
* notable idiosyncrasy of the Command(s) API to be mindful of here is that
|
|
||||||
* the command may be issued by the local participant.
|
|
||||||
*/
|
|
||||||
_onCustomRoleCommand ({ attributes }, id) {
|
|
||||||
// We require to know who issued the command because (1) only a
|
|
||||||
// moderator is allowed to send commands and (2) a command MUST be
|
|
||||||
// issued by a defined commander.
|
|
||||||
if (typeof id === 'undefined'
|
|
||||||
|| this._conference.isLocalId(id)
|
|
||||||
|| !attributes.recorderRole)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var isRecorder = (attributes.recorderRole == 'true');
|
|
||||||
|
|
||||||
if (isRecorder)
|
|
||||||
VideoLayout.enableDeviceAvailabilityIcons(id, isRecorder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Recorder;
|
|
Loading…
Reference in New Issue