implementation of "start muted"

This commit is contained in:
isymchych 2015-12-31 17:23:23 +02:00
parent 3fd68fa0fd
commit 0262917aa6
9 changed files with 1032 additions and 563 deletions

1
.gitattributes vendored
View File

@ -1 +1,2 @@
*.bundle.js -text -diff
lib-jitsi-meet.js -text -diff

2
app.js
View File

@ -1,4 +1,4 @@
/* global $, JitsiMeetJS, config, interfaceConfig */
/* global $, JitsiMeetJS, config */
/* application specific logic */
import "babel-polyfill";

View File

@ -15,8 +15,7 @@ const ConnectionErrors = JitsiMeetJS.errors.connection;
const ConferenceEvents = JitsiMeetJS.events.conference;
const ConferenceErrors = JitsiMeetJS.errors.conference;
let room, connection, localTracks, localAudio, localVideo;
let roomLocker = createRoomLocker(room);
let room, connection, localTracks, localAudio, localVideo, roomLocker;
const Commands = {
CONNECTION_QUALITY: "stats",
@ -223,7 +222,13 @@ export default {
return room.isSIPCallingSupported();
},
get membersCount () {
return room.getParticipants().length; // FIXME maybe +1?
return room.getParticipants().length + 1;
},
get startAudioMuted () {
return room && room.isStartAudioMuted();
},
get startVideoMuted () {
return room && room.isStartVideoMuted();
},
// used by torture currently
isJoined () {
@ -241,6 +246,7 @@ export default {
_createRoom () {
room = connection.initJitsiConference(APP.conference.roomName,
this._getConferenceOptions());
roomLocker = createRoomLocker(room);
this._room = room; // FIXME do not use this
this.localId = room.myUserId();
@ -508,7 +514,16 @@ export default {
APP.UI.addListener(UIEvents.START_MUTED_CHANGED,
(startAudioMuted, startVideoMuted) => {
// FIXME start muted
room.setStartMuted(startAudioMuted, startVideoMuted);
}
);
room.on(
ConferenceEvents.START_MUTED,
function (startAudioMuted, startVideoMuted, initiallyMuted) {
APP.UI.onStartMutedChanged();
if (initiallyMuted) {
APP.UI.notifyInitiallyMuted();
}
}
);

File diff suppressed because it is too large Load Diff

View File

@ -781,4 +781,8 @@ UI.stopPrezi = function (userId) {
}
};
UI.onStartMutedChanged = function () {
SettingsMenu.onStartMutedChanged();
};
module.exports = UI;

View File

@ -2,6 +2,7 @@
import UIUtil from "../../util/UIUtil";
import UIEvents from "../../../../service/UI/UIEvents";
import languages from "../../../../service/translation/languages";
import Settings from '../../../settings/Settings';
function generateLanguagesSelectBox() {
var currentLang = APP.translation.getCurrentLanguage();
@ -21,32 +22,53 @@ function generateLanguagesSelectBox() {
}
const SettingsMenu = {
export default {
init (emitter) {
function update() {
let displayName = UIUtil.escapeHtml($('#setDisplayName').val());
init: function (emitter) {
this.emitter = emitter;
if (displayName && Settings.getDisplayName() !== displayName) {
emitter.emit(UIEvents.NICKNAME_CHANGED, displayName);
}
var startMutedSelector = $("#startMutedOptions");
startMutedSelector.before(generateLanguagesSelectBox());
let language = $("#languages_selectbox").val();
if (language !== Settings.getLanguage()) {
emitter.emit(UIEvents.LANG_CHANGED, language);
}
let email = UIUtil.escapeHtml($('#setEmail').val());
if (email !== Settings.getEmail()) {
emitter.emit(UIEvents.EMAIL_CHANGED, email);
}
let startAudioMuted = $("#startAudioMuted").is(":checked");
let startVideoMuted = $("#startVideoMuted").is(":checked");
if (startAudioMuted !== APP.conference.startAudioMuted
|| startVideoMuted !== APP.conference.startVideoMuted) {
emitter.emit(
UIEvents.START_MUTED_CHANGED,
startAudioMuted,
startVideoMuted
);
}
}
let startMutedBlock = $("#startMutedOptions");
startMutedBlock.before(generateLanguagesSelectBox());
APP.translation.translateElement($("#languages_selectbox"));
this.onRoleChanged();
this.onStartMutedChanged();
$("#updateSettings").click(update);
$('#settingsmenu>input').keyup(function(event){
if(event.keyCode === 13) {//enter
SettingsMenu.update();
if (event.keyCode === 13) {//enter
update();
}
});
if (APP.conference.isModerator) {
startMutedSelector.css("display", "block");
} else {
startMutedSelector.css("display", "none");
}
$("#updateSettings").click(function () {
SettingsMenu.update();
});
},
onRoleChanged: function () {
onRoleChanged () {
if(APP.conference.isModerator) {
$("#startMutedOptions").css("display", "block");
}
@ -55,46 +77,22 @@ const SettingsMenu = {
}
},
setStartMuted: function (audio, video) {
$("#startAudioMuted").attr("checked", audio);
$("#startVideoMuted").attr("checked", video);
onStartMutedChanged () {
$("#startAudioMuted").attr("checked", APP.conference.startAudioMuted);
$("#startVideoMuted").attr("checked", APP.conference.startVideoMuted);
},
update: function() {
// FIXME check if this values really changed:
// compare them with Settings etc.
var newDisplayName =
UIUtil.escapeHtml($('#setDisplayName').get(0).value);
if (newDisplayName) {
this.emitter.emit(UIEvents.NICKNAME_CHANGED, newDisplayName);
}
var language = $("#languages_selectbox").val();
this.emitter.emit(UIEvents.LANG_CHANGED, language);
var newEmail = UIUtil.escapeHtml($('#setEmail').get(0).value);
this.emitter.emit(UIEvents.EMAIL_CHANGED, newEmail);
var startAudioMuted = ($("#startAudioMuted").is(":checked"));
var startVideoMuted = ($("#startVideoMuted").is(":checked"));
this.emitter.emit(
UIEvents.START_MUTED_CHANGED, startAudioMuted, startVideoMuted
);
},
isVisible: function() {
isVisible () {
return $('#settingsmenu').is(':visible');
},
onDisplayNameChange: function(id, newDisplayName) {
onDisplayNameChange (id, newDisplayName) {
if(id === 'localVideoContainer' || APP.conference.isLocalId(id)) {
$('#setDisplayName').get(0).value = newDisplayName;
$('#setDisplayName').val(newDisplayName);
}
},
changeAvatar: function (thumbUrl) {
$('#avatar').get(0).src = thumbUrl;
changeAvatar (thumbUrl) {
$('#avatar').attr('src', thumbUrl);
}
};
export default SettingsMenu;

View File

@ -157,7 +157,9 @@ var VideoLayout = {
let {thumbWidth, thumbHeight} = this.calculateThumbnailSize();
AudioLevels.updateAudioLevelCanvas(null, thumbWidth, thumbHeight);
if (!stream.isMuted()) {
localVideoThumbnail.changeVideo(stream);
}
/* force update if we're currently being displayed */
if (this.isCurrentlyOnLarge(localId)) {

View File

@ -97,7 +97,7 @@ module.exports = {
} else {
type = "video";
}
APP.createLocalTracks(type).then(function (tracks) {
APP.conference.createLocalTracks(type).then(function (tracks) {
if (!tracks.length) {
if (type === 'desktop') {
getDesktopStreamFailed();

View File

@ -86,8 +86,6 @@ var XMPPEvents = {
JINGLE_FATAL_ERROR: 'xmpp.jingle_fatal_error',
PROMPT_FOR_LOGIN: 'xmpp.prompt_for_login',
FOCUS_DISCONNECTED: 'xmpp.focus_disconnected',
ROOM_JOIN_ERROR: 'xmpp.room_join_error',
ROOM_CONNECT_ERROR: 'xmpp.room_connect_error',
// xmpp is connected and obtained user media
READY_TO_JOIN: 'xmpp.ready_to_join'
};