Browse Source

Merge pull request #705 from nextcloud/feature/308/shortcuts-for-calls

Add shortcuts for calling
pull/717/head
Joas Schilling 8 years ago
committed by GitHub
parent
commit
db34097aa6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 59
      js/app.js

59
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',
@ -609,6 +652,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')
@ -617,6 +664,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')
@ -625,6 +676,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');
@ -642,6 +697,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');

Loading…
Cancel
Save