Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

OPENTOK-44484: replaced 'mute on entry' and 'disable mute on entry' buttons with a single toggle button #147

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions src/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ angular.module('opentok-meet').controller('RoomCtrl', ['$scope', '$http', '$wind
$scope.webviewComposerId = null;
$scope.startingWebviewComposing = false;
$scope.webViewComposerStreamId = null;
$scope.muteOnEntry = false;

const url = new URL($window.location.href);
let enableDtx = true;
Expand Down Expand Up @@ -86,21 +87,27 @@ angular.module('opentok-meet').controller('RoomCtrl', ['$scope', '$http', '$wind
});
};

$scope.muteOnEntry = () => {
const myStream = OT.publishers.find().stream;
$scope.session.forceMuteAll([myStream]).then(() => {
console.log('Enable MuteOnEntry complete');
}).catch((error) => {
console.error('Enable MuteOnEntry failed', error);
});
};

$scope.disableMuteOnEntry = () => {
$scope.session.disableForceMute().then(() => {
console.log('Disable MuteOnEntry complete');
}).catch((error) => {
console.error('Disable MuteOnEntry failed', error);
});
$scope.toggleMuteOnEntry = () => {
$scope.muteOnEntry = !$scope.muteOnEntry;
if (!$scope.muteOnEntry) {
const myStream = OT.publishers.find().stream;
$scope.session.forceMuteAll([myStream]).then(() => {
console.log('Enable MuteOnEntry complete');
}).catch((error) => {
$scope.muteOnEntry = !$scope.muteOnEntry;
console.error('Enable MuteOnEntry failed', error);
cpettet marked this conversation as resolved.
Show resolved Hide resolved
});
} else {
$scope.session
.disableForceMute()
.then(() => {
console.log('Disable MuteOnEntry complete');
})
.catch((error) => {
$scope.muteOnEntry = !$scope.muteOnEntry;
console.error('Disable MuteOnEntry failed', error);
});
}
};

$scope.forceMuteAllExcludingPublisherStream = () => {
Expand Down
4 changes: 1 addition & 3 deletions views/room.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@

<button type="button" name="muteAllExcludingPublishingStream" id="muteAllExcludingPublishingStream" ng-click="forceMuteAllExcludingPublisherStream()" class="icon-left ion gray" ng-if="isModerator">Mute All Excluding Publishing Stream</button>

<button type="button" name="enableMuteOnEntry" id="enableMuteOnEntry" ng-click="muteOnEntry()" class="icon-left ion gray" ng-if="isModerator">Enable Mute On Entry</button>

<button type="button" name="disableMuteOnEntry" id="disableMuteOnEntry" ng-click="disableMuteOnEntry()" class="icon-left ion gray" ng-if="isModerator">Disable Mute On Entry</button>
<button type="button" name="toggleMuteOnEntry" id="toggleMuteOnEntry" ng-click="toggleMuteOnEntry()" ng-class="{green: !muteOnEntry, red: muteOnEntry}" class="icon-left ion" ng-if="isModerator">Mute On Entry</button>

<span id="publishUI">
<button name="publish" id="publishBtn" ng-click="togglePublish(true)" ng-class="{green: !publishing, red: publishing}" class="publish-btn icon-left ion ion-ios7-videocam" title="WebCam">{{ publishing ? 'Unpublish' : 'Publish HD'}}</button>
Expand Down