Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js/app.js
diff options
context:
space:
mode:
authorIvan Sein <ivan@struktur.de>2018-03-23 12:10:34 +0300
committerGitHub <noreply@github.com>2018-03-23 12:10:34 +0300
commit03ab2166ea9e2c1d88d7b8bc32343ab53805a9bd (patch)
treee9daf606023e9d749097b8d04f8e9e95eab8d9f3 /js/app.js
parentc69405ec43c8737c33ac9575fdf18c1b6dcb38ad (diff)
parent19872ae4acd1af7dded5112ef1cb39671f5d89ee (diff)
Merge pull request #730 from nextcloud/backport/705/shortcuts-for-calls
[stable13] Add shortcuts for calling
Diffstat (limited to 'js/app.js')
-rw-r--r--js/app.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/js/app.js b/js/app.js
index fe3271c40..1f504b536 100644
--- a/js/app.js
+++ b/js/app.js
@@ -319,7 +319,50 @@
OCA.SpreedMe.webrtc.stopScreenShare();
screensharingStopped();
});
+
+ $(document).keyup(this._onKeyUp.bind(this));
},
+
+ _onKeyUp: function(event) {
+ // Define which objects to check for the event properties.
+ var key = event.which;
+
+ // Trigger the event only if no input or textarea is focused
+ // and the CTRL key is not pressed
+ if ($('input:focus').length === 0 &&
+ $('textarea:focus').length === 0 &&
+ !event.ctrlKey) {
+
+ // Actual shortcut handling
+ switch (key) {
+ case 86: // 'v'
+ event.preventDefault();
+ if (this.videoDisabled) {
+ this.enableVideo();
+ } else {
+ this.disableVideo();
+ }
+ break;
+ case 65: // 'a'
+ event.preventDefault();
+ if (this.audioDisabled) {
+ this.enableAudio();
+ } else {
+ this.disableAudio();
+ }
+ break;
+ case 67: // 'c'
+ event.preventDefault();
+ this._sidebarView.selectTab('chat');
+ break;
+ case 80: // 'p'
+ event.preventDefault();
+ this._sidebarView.selectTab('participants');
+ break;
+ }
+ }
+ },
+
_showRoomList: function() {
this._roomsView = new OCA.SpreedMe.Views.RoomListView({
el: '#app-navigation ul',
@@ -614,6 +657,10 @@
}
},
enableAudio: function() {
+ if (!OCA.SpreedMe.webrtc) {
+ return;
+ }
+
OCA.SpreedMe.webrtc.unmute();
$('#mute').attr('data-original-title', t('spreed', 'Mute audio'))
.removeClass('audio-disabled icon-audio-off')
@@ -622,6 +669,10 @@
OCA.SpreedMe.app.audioDisabled = false;
},
disableAudio: function() {
+ if (!OCA.SpreedMe.webrtc) {
+ return;
+ }
+
OCA.SpreedMe.webrtc.mute();
$('#mute').attr('data-original-title', t('spreed', 'Enable audio'))
.addClass('audio-disabled icon-audio-off')
@@ -630,6 +681,10 @@
OCA.SpreedMe.app.audioDisabled = true;
},
enableVideo: function() {
+ if (!OCA.SpreedMe.webrtc) {
+ return;
+ }
+
var $hideVideoButton = $('#hideVideo');
var $audioMuteButton = $('#mute');
var avatarContainer = $hideVideoButton.closest('.videoView').find('.avatar-container');
@@ -647,6 +702,10 @@
OCA.SpreedMe.app.videoDisabled = false;
},
hideVideo: function() {
+ if (!OCA.SpreedMe.webrtc) {
+ return;
+ }
+
var $hideVideoButton = $('#hideVideo');
var $audioMuteButton = $('#mute');
var avatarContainer = $hideVideoButton.closest('.videoView').find('.avatar-container');