Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable13] Add shortcuts for calling #730

Merged
merged 1 commit into from
Mar 23, 2018
Merged
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
59 changes: 59 additions & 0 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -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');
Expand All @@ -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');
Expand Down