Combine methods to enable and disable video

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2019-02-18 15:27:00 +01:00
Родитель 3a7b1a3c3a
Коммит e485e34022
3 изменённых файлов: 20 добавлений и 28 удалений

Просмотреть файл

@ -758,7 +758,7 @@
this.fullscreenDisabled = true;
},
enableVideo: function() {
if (!this._mediaControlsView.enableVideo()) {
if (!this._mediaControlsView.setVideoEnabled(true)) {
return;
}
@ -769,7 +769,7 @@
localVideo.show();
},
disableVideo: function() {
if (!this._mediaControlsView.disableVideo()) {
if (!this._mediaControlsView.setVideoEnabled(false)) {
return;
}

Просмотреть файл

@ -204,7 +204,7 @@
}
},
enableVideo: function() {
if (!this._mediaControlsView.enableVideo()) {
if (!this._mediaControlsView.setVideoEnabled(true)) {
return;
}
@ -215,7 +215,7 @@
localVideo.show();
},
disableVideo: function() {
if (!this._mediaControlsView.disableVideo()) {
if (!this._mediaControlsView.setVideoEnabled(false)) {
return;
}

Просмотреть файл

@ -167,38 +167,30 @@
}
},
disableVideo: function() {
setVideoEnabled: function(videoEnabled) {
if (!this._videoAvailable || !this._webrtc) {
return false;
}
this._webrtc.pauseVideo();
if (videoEnabled) {
this._webrtc.resumeVideo();
this.getUI('videoButton').attr('data-original-title', t('spreed', 'Enable video (v)'))
.addClass('local-video-disabled video-disabled icon-video-off')
.removeClass('icon-video');
this.getUI('audioButton').addClass('local-video-disabled');
this.getUI('screensharingButton').addClass('local-video-disabled');
this.getUI('videoButton').attr('data-original-title', t('spreed', 'Disable video (v)'))
.removeClass('local-video-disabled video-disabled icon-video-off')
.addClass('icon-video');
this.getUI('audioButton').removeClass('local-video-disabled');
this.getUI('screensharingButton').removeClass('local-video-disabled');
} else {
this._webrtc.pauseVideo();
this.videoEnabled = false;
return true;
},
enableVideo: function() {
if (!this._videoAvailable || !this._webrtc) {
return false;
this.getUI('videoButton').attr('data-original-title', t('spreed', 'Enable video (v)'))
.addClass('local-video-disabled video-disabled icon-video-off')
.removeClass('icon-video');
this.getUI('audioButton').addClass('local-video-disabled');
this.getUI('screensharingButton').addClass('local-video-disabled');
}
this._webrtc.resumeVideo();
this.getUI('videoButton').attr('data-original-title', t('spreed', 'Disable video (v)'))
.removeClass('local-video-disabled video-disabled icon-video-off')
.addClass('icon-video');
this.getUI('audioButton').removeClass('local-video-disabled');
this.getUI('screensharingButton').removeClass('local-video-disabled');
this.videoEnabled = true;
this.videoEnabled = videoEnabled;
return true;
},