mirror of https://github.com/OpenVidu/openvidu.git
openvidu-components: Released media devices on videoconference destroy
parent
628b62c0aa
commit
493f1e3ba0
|
@ -79,7 +79,6 @@ export class PreJoinComponent implements OnInit, OnDestroy {
|
||||||
if (this.screenShareStateSubscription) {
|
if (this.screenShareStateSubscription) {
|
||||||
this.screenShareStateSubscription.unsubscribe();
|
this.screenShareStateSubscription.unsubscribe();
|
||||||
}
|
}
|
||||||
this.deviceSrv.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async onCameraSelected(event: any) {
|
async onCameraSelected(event: any) {
|
||||||
|
|
|
@ -359,6 +359,8 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
if (this.prejoinSub) this.prejoinSub.unsubscribe();
|
if (this.prejoinSub) this.prejoinSub.unsubscribe();
|
||||||
if (this.participantNameSub) this.participantNameSub.unsubscribe();
|
if (this.participantNameSub) this.participantNameSub.unsubscribe();
|
||||||
|
this.deviceSrv.clear();
|
||||||
|
this.openviduService.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -60,6 +60,16 @@ export class OpenViduService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
clear() {
|
||||||
|
this.videoSource = undefined;
|
||||||
|
this.audioSource = undefined;
|
||||||
|
this.stopTracks(this.participantService.getMyCameraPublisher()?.stream?.getMediaStream());
|
||||||
|
this.stopTracks(this.participantService.getMyScreenPublisher()?.stream?.getMediaStream());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Returns the local Session. See {@link https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/Session.html Session} object.
|
* Returns the local Session. See {@link https://docs.openvidu.io/en/stable/api/openvidu-browser/classes/Session.html Session} object.
|
||||||
|
@ -130,10 +140,6 @@ export class OpenViduService {
|
||||||
disconnect() {
|
disconnect() {
|
||||||
this.disconnectSession(this.webcamSession);
|
this.disconnectSession(this.webcamSession);
|
||||||
this.disconnectSession(this.screenSession);
|
this.disconnectSession(this.screenSession);
|
||||||
this.videoSource = undefined;
|
|
||||||
this.audioSource = undefined;
|
|
||||||
// this.stopTracks(this.participantService.getMyCameraPublisher()?.stream?.getMediaStream());
|
|
||||||
// this.stopTracks(this.participantService.getMyScreenPublisher()?.stream?.getMediaStream());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -567,11 +573,11 @@ export class OpenViduService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// private stopTracks(mediaStream: MediaStream) {
|
private stopTracks(mediaStream: MediaStream) {
|
||||||
// if (mediaStream) {
|
if (mediaStream) {
|
||||||
// mediaStream?.getAudioTracks().forEach((track) => track.stop());
|
mediaStream?.getAudioTracks().forEach((track) => track.stop());
|
||||||
// mediaStream?.getVideoTracks().forEach((track) => track.stop());
|
mediaStream?.getVideoTracks().forEach((track) => track.stop());
|
||||||
// // this.webcamMediaStream?.getAudioTracks().forEach((track) => track.stop());
|
// this.webcamMediaStream?.getAudioTracks().forEach((track) => track.stop());
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue