mirror of https://github.com/OpenVidu/openvidu.git
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
parent
ce230f059a
commit
53d54a682e
|
@ -1,5 +1,5 @@
|
||||||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { PublisherSpeakingEvent, StreamManager, StreamPropertyChangedEvent } from 'openvidu-browser';
|
import { PublisherSpeakingEvent, StreamManager } from 'openvidu-browser';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
|
@ -18,25 +18,12 @@ export class AudioWaveComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.subscribeSpeakingEvents();
|
this.subscribeSpeakingEvents();
|
||||||
this.subscribeToStreamPropertyChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.unsubscribeSpeakingEvents();
|
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() {
|
private subscribeSpeakingEvents() {
|
||||||
if (this.streamManager) {
|
if (this.streamManager) {
|
||||||
|
@ -51,9 +38,4 @@ export class AudioWaveComponent implements OnInit, OnDestroy {
|
||||||
this.streamManager.off('publisherStopSpeaking');
|
this.streamManager.off('publisherStopSpeaking');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private unsubscribePropertyChangedEvents() {
|
|
||||||
if (this.streamManager) {
|
|
||||||
this.streamManager.off('streamPropertyChanged');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue