openvidu-components: Reapplied background on video replace track

pull/748/head
Carlos Santos 2022-11-02 12:26:00 +01:00
parent f5fc739ea1
commit 42279d557d
1 changed files with 4 additions and 2 deletions

View File

@ -83,13 +83,15 @@ export class VideoDevicesComponent implements OnInit, OnDestroy {
const mirror = this.deviceSrv.cameraNeedsMirror(videoSource); const mirror = this.deviceSrv.cameraNeedsMirror(videoSource);
// Reapply Virtual Background to new Publisher if necessary // Reapply Virtual Background to new Publisher if necessary
const backgroundSelected = this.backgroundService.backgroundSelected.getValue(); const backgroundSelected = this.backgroundService.backgroundSelected.getValue();
if (this.backgroundService.isBackgroundApplied()) { const isBackgroundApplied = this.backgroundService.isBackgroundApplied()
if (isBackgroundApplied) {
await this.backgroundService.removeBackground(); await this.backgroundService.removeBackground();
} }
const pp: PublisherProperties = { videoSource, audioSource: false, mirror }; const pp: PublisherProperties = { videoSource, audioSource: false, mirror };
await this.openviduService.replaceTrack(VideoType.CAMERA, pp); await this.openviduService.replaceTrack(VideoType.CAMERA, pp);
if (this.backgroundService.isBackgroundApplied()) { if (isBackgroundApplied) {
const bgSelected = this.backgroundService.backgrounds.find((b) => b.id === backgroundSelected); const bgSelected = this.backgroundService.backgrounds.find((b) => b.id === backgroundSelected);
if (bgSelected) { if (bgSelected) {
await this.backgroundService.applyBackground(bgSelected); await this.backgroundService.applyBackground(bgSelected);