From 7d0cd00a509c42e35d0c44e4c37c5322d0eaf325 Mon Sep 17 00:00:00 2001 From: damencho Date: Fri, 25 Mar 2016 19:38:56 -0500 Subject: [PATCH 1/2] Enables shared video for all participants, the first to share is the video all will see, later attempts will result just a dialog informing that video is already shared. --- conference.js | 10 ---------- lang/main.json | 1 + modules/UI/shared_video/SharedVideo.js | 11 +++++++++-- modules/UI/toolbars/Toolbar.js | 5 +++-- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/conference.js b/conference.js index d48388422..e71db8db5 100644 --- a/conference.js +++ b/conference.js @@ -1114,16 +1114,6 @@ export default { room.addCommandListener( Commands.SHARED_VIDEO, ({value, attributes}, id) => { - // if we are not the moderator or - // the command is coming from a user which is not the moderator - if (!(this.isLocalId(id) && room.isModerator()) - && !this.isParticipantModerator(id)) - { - console.warn('Received shared video command ' + - 'not from moderator'); - return; - } - if (attributes.state === 'stop') { APP.UI.stopSharedVideo(id, attributes); } else if (attributes.state === 'start') { diff --git a/lang/main.json b/lang/main.json index f03c1bbc3..24199d190 100644 --- a/lang/main.json +++ b/lang/main.json @@ -166,6 +166,7 @@ "shareVideoLinkError": "Please provide a correct youtube link.", "removeSharedVideoTitle": "Remove shared video", "removeSharedVideoMsg": "Are you sure you would like to remove your shared video?", + "alreadySharedVideoMsg": "Another participant is already sharing video. This conference allows only one shared video at a time.", "WaitingForHost": "Waiting for the host ...", "WaitForHostMsg": "The conference __room__ has not yet started. If you are the host then please authenticate. Otherwise, please wait for the host to arrive.", "IamHost": "I am the host", diff --git a/modules/UI/shared_video/SharedVideo.js b/modules/UI/shared_video/SharedVideo.js index f769a1f59..75899715d 100644 --- a/modules/UI/shared_video/SharedVideo.js +++ b/modules/UI/shared_video/SharedVideo.js @@ -43,8 +43,15 @@ export default class SharedVideoManager { return; } - showStopVideoPropmpt().then(() => - this.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO, null, 'stop')); + if(APP.conference.isLocalId(this.from)) { + showStopVideoPropmpt().then(() => + this.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO, null, 'stop')); + } else { + messageHandler.openMessageDialog( + "dialog.shareVideoTitle", + "dialog.alreadySharedVideoMsg" + ); + } } /** diff --git a/modules/UI/toolbars/Toolbar.js b/modules/UI/toolbars/Toolbar.js index 890b13bb2..687e91783 100644 --- a/modules/UI/toolbars/Toolbar.js +++ b/modules/UI/toolbars/Toolbar.js @@ -289,8 +289,9 @@ const Toolbar = { }, // Shows or hides the 'shared video' button. - showSharedVideoButton (show) { - if (UIUtil.isButtonEnabled('sharedvideo') && show) { + showSharedVideoButton () { + if (UIUtil.isButtonEnabled('sharedvideo') + && config.disableThirdPartyRequests !== true) { $('#toolbar_button_sharedvideo').css({display: "inline-block"}); } else { $('#toolbar_button_sharedvideo').css({display: "none"}); From 885210452cbfae614dbc2930594a68be7f9a94f8 Mon Sep 17 00:00:00 2001 From: damencho Date: Mon, 28 Mar 2016 11:46:45 -0500 Subject: [PATCH 2/2] Updates button states on non moderator participants before showing the toolbar. --- modules/UI/UI.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/UI/UI.js b/modules/UI/UI.js index c0fad8f89..1202a429e 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -233,6 +233,10 @@ UI.initConference = function () { // Add myself to the contact list. ContactList.addContact(id); + //update default button states before showing the toolbar + //if local role changes buttons state will be again updated + UI.updateLocalRole(false); + // Once we've joined the muc show the toolbar ToolbarToggler.showToolbar();