openvidu-components: Renamed service method

pull/713/head
csantosm 2022-04-01 13:24:56 +02:00
parent 1cdb938ad4
commit 1ee8bd1f6e
3 changed files with 10 additions and 10 deletions

View File

@ -117,14 +117,14 @@ export class PreJoinComponent implements OnInit, OnDestroy {
async toggleCam() { async toggleCam() {
const publish = this.isVideoMuted; const publish = this.isVideoMuted;
await this.openviduService.muteVideo(publish); await this.openviduService.publishVideo(publish);
this.isVideoMuted = !this.isVideoMuted; this.isVideoMuted = !this.isVideoMuted;
this.storageSrv.setVideoMuted(this.isVideoMuted); this.storageSrv.setVideoMuted(this.isVideoMuted);
} }
toggleMic() { toggleMic() {
const publish = this.isAudioMuted; const publish = this.isAudioMuted;
this.openviduService.muteAudio(publish); this.openviduService.publishAudio(publish);
this.isAudioMuted = !this.isAudioMuted; this.isAudioMuted = !this.isAudioMuted;
this.storageSrv.setAudioMuted(this.isAudioMuted); this.storageSrv.setAudioMuted(this.isAudioMuted);
} }

View File

@ -288,7 +288,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
async toggleMicrophone() { async toggleMicrophone() {
this.onMicrophoneButtonClicked.emit(); this.onMicrophoneButtonClicked.emit();
try { try {
await this.openviduService.muteAudio(!this.isAudioActive); await this.openviduService.publishAudio(!this.isAudioActive);
} catch (error) { } catch (error) {
this.log.e('There was an error toggling microphone:', error.code, error.message); this.log.e('There was an error toggling microphone:', error.code, error.message);
this.actionService.openDialog('There was an error toggling camera', error?.error || error?.message); this.actionService.openDialog('There was an error toggling camera', error?.error || error?.message);
@ -303,7 +303,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
try { try {
const publishVideo = !this.participantService.hasCameraVideoActive(); const publishVideo = !this.participantService.hasCameraVideoActive();
await this.openviduService.muteVideo(publishVideo); await this.openviduService.publishVideo(publishVideo);
} catch (error) { } catch (error) {
this.log.e('There was an error toggling camera:', error.code, error.message); this.log.e('There was an error toggling camera:', error.code, error.message);
this.actionService.openDialog('There was an error toggling camera', error?.error || error?.message); this.actionService.openDialog('There was an error toggling camera', error?.error || error?.message);

View File

@ -220,13 +220,13 @@ export class OpenViduService {
} }
} }
async muteVideo(mute: boolean): Promise<void> { async publishVideo(publish: boolean): Promise<void> {
const publishAudio = this.participantService.hasCameraAudioActive(); const publishAudio = this.participantService.hasCameraAudioActive();
// const publishVideo = !this.participantService.hasCameraVideoActive(); // const publishVideo = !this.participantService.hasCameraVideoActive();
// Disabling webcam // Disabling webcam
if (this.participantService.haveICameraAndScreenActive()) { if (this.participantService.haveICameraAndScreenActive()) {
this.publishVideoAux(this.participantService.getMyCameraPublisher(), mute); this.publishVideoAux(this.participantService.getMyCameraPublisher(), publish);
this.participantService.disableWebcamStream(); this.participantService.disableWebcamStream();
this.unpublish(this.participantService.getMyCameraPublisher()); this.unpublish(this.participantService.getMyCameraPublisher());
this.publishAudioAux(this.participantService.getMyScreenPublisher(), publishAudio); this.publishAudioAux(this.participantService.getMyScreenPublisher(), publishAudio);
@ -245,7 +245,7 @@ export class OpenViduService {
this.participantService.enableWebcamStream(); this.participantService.enableWebcamStream();
} else { } else {
// Muting/unmuting webcam // Muting/unmuting webcam
this.publishVideoAux(this.participantService.getMyCameraPublisher(), mute); this.publishVideoAux(this.participantService.getMyCameraPublisher(), publish);
} }
} }
@ -259,15 +259,15 @@ export class OpenViduService {
} }
} }
async muteAudio(value: boolean): Promise<void> { async publishAudio(publish: boolean): Promise<void> {
if (this.participantService.isMyCameraActive()) { if (this.participantService.isMyCameraActive()) {
if (this.participantService.isMyScreenActive() && this.participantService.hasScreenAudioActive()) { if (this.participantService.isMyScreenActive() && this.participantService.hasScreenAudioActive()) {
this.publishAudioAux(this.participantService.getMyScreenPublisher(), false); this.publishAudioAux(this.participantService.getMyScreenPublisher(), false);
} }
this.publishAudioAux(this.participantService.getMyCameraPublisher(), value); this.publishAudioAux(this.participantService.getMyCameraPublisher(), publish);
} else { } else {
this.publishAudioAux(this.participantService.getMyScreenPublisher(), value); this.publishAudioAux(this.participantService.getMyScreenPublisher(), publish);
} }
} }