openvidu-components: Removed unnecessary code after fixed hark

openvidu-browser hark events bug has been fixed so it is not necessary to resubscribe again after audio track is replaced.
pull/743/head
csantosm 2022-07-07 17:47:27 +02:00
parent ce230f059a
commit 53d54a682e
1 changed files with 1 additions and 19 deletions

View File

@ -1,5 +1,5 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { PublisherSpeakingEvent, StreamManager, StreamPropertyChangedEvent } from 'openvidu-browser';
import { PublisherSpeakingEvent, StreamManager } from 'openvidu-browser';
/**
* @internal
@ -18,25 +18,12 @@ export class AudioWaveComponent implements OnInit, OnDestroy {
ngOnInit(): void {
this.subscribeSpeakingEvents();
this.subscribeToStreamPropertyChanged();
}
ngOnDestroy(): void {
this.unsubscribeSpeakingEvents();
this.unsubscribePropertyChangedEvents();
}
private subscribeToStreamPropertyChanged() {
if (this.streamManager) {
this.streamManager.on('streamPropertyChanged', (event: StreamPropertyChangedEvent) => {
if (event.reason === 'trackReplaced' && event.changedProperty === 'audioActive') {
// TODO: When the audio track is replaced, the startSpeakingEvents is not fired by openvidu-browser
this.unsubscribeSpeakingEvents();
this.subscribeSpeakingEvents();
}
});
}
}
private subscribeSpeakingEvents() {
if (this.streamManager) {
@ -51,9 +38,4 @@ export class AudioWaveComponent implements OnInit, OnDestroy {
this.streamManager.off('publisherStopSpeaking');
}
}
private unsubscribePropertyChangedEvents() {
if (this.streamManager) {
this.streamManager.off('streamPropertyChanged');
}
}
}