openvidu-components: Fixed bug when toggling audio in with screenshare

pull/713/head
csantosm 2022-03-30 11:58:35 +02:00
parent 06f1fcbee1
commit af3c21742f
2 changed files with 9 additions and 8 deletions

View File

@ -12,10 +12,10 @@
mat-icon-button mat-icon-button
(click)="toggleMicrophone()" (click)="toggleMicrophone()"
[disabled]="isConnectionLost || !hasAudioDevices" [disabled]="isConnectionLost || !hasAudioDevices"
[class.warn-btn]="!isWebcamAudioActive" [class.warn-btn]="!isAudioActive"
> >
<mat-icon *ngIf="isWebcamAudioActive" matTooltip="Mute your audio" id="mic">mic</mat-icon> <mat-icon *ngIf="isAudioActive" matTooltip="Mute your audio" id="mic">mic</mat-icon>
<mat-icon *ngIf="!isWebcamAudioActive" matTooltip="Unmute your audio" id="mic_off">mic_off</mat-icon> <mat-icon *ngIf="!isAudioActive" matTooltip="Unmute your audio" id="mic_off">mic_off</mat-icon>
</button> </button>
<!-- Camera button --> <!-- Camera button -->

View File

@ -28,6 +28,7 @@ import { ParticipantService } from '../../services/participant/participant.servi
import { MenuType } from '../../models/menu.model'; import { MenuType } from '../../models/menu.model';
import { OpenViduAngularConfigService } from '../../services/config/openvidu-angular.config.service'; import { OpenViduAngularConfigService } from '../../services/config/openvidu-angular.config.service';
import { ToolbarAdditionalButtonsDirective } from '../../directives/template/openvidu-angular.directive'; import { ToolbarAdditionalButtonsDirective } from '../../directives/template/openvidu-angular.directive';
import { ParticipantAbstractModel } from '../../models/participant.model';
/** /**
* *
@ -138,7 +139,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
/** /**
* @ignore * @ignore
*/ */
isWebcamAudioActive: boolean; isAudioActive: boolean;
/** /**
* @ignore * @ignore
*/ */
@ -293,9 +294,9 @@ export class ToolbarComponent implements OnInit, OnDestroy {
this.participantService.getMyCameraPublisher(), this.participantService.getMyCameraPublisher(),
!this.participantService.hasCameraAudioActive() !this.participantService.hasCameraAudioActive()
); );
return; } else {
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), !this.participantService.hasScreenAudioActive());
} }
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), !this.participantService.hasScreenAudioActive());
} }
/** /**
@ -480,10 +481,10 @@ export class ToolbarComponent implements OnInit, OnDestroy {
}); });
} }
protected subscribeToUserMediaProperties() { protected subscribeToUserMediaProperties() {
this.localParticipantSubscription = this.participantService.localParticipantObs.subscribe((p) => { this.localParticipantSubscription = this.participantService.localParticipantObs.subscribe((p: ParticipantAbstractModel) => {
if (p) { if (p) {
this.isWebcamVideoActive = p.isCameraVideoActive(); this.isWebcamVideoActive = p.isCameraVideoActive();
this.isWebcamAudioActive = p.isCameraAudioActive(); this.isAudioActive = p.isCameraAudioActive() || p.isScreenAudioActive();
this.isScreenShareActive = p.isScreenActive(); this.isScreenShareActive = p.isScreenActive();
this.cd.markForCheck(); this.cd.markForCheck();
} }