mirror of https://github.com/OpenVidu/openvidu.git
commit
0f90627f03
|
@ -86,14 +86,8 @@ export class WebRtcPeer {
|
||||||
reject('The peer connection object is in "closed" state. This is most likely due to an invocation of the dispose method before accepting in the dialogue');
|
reject('The peer connection object is in "closed" state. This is most likely due to an invocation of the dispose method before accepting in the dialogue');
|
||||||
}
|
}
|
||||||
if (!!this.configuration.mediaStream) {
|
if (!!this.configuration.mediaStream) {
|
||||||
if (platform['isIonicIos']) {
|
for (const track of this.configuration.mediaStream.getTracks()) {
|
||||||
// iOS Ionic. LIMITATION: must use deprecated WebRTC API
|
this.pc.addTrack(track, this.configuration.mediaStream);
|
||||||
const pc2: any = this.pc;
|
|
||||||
pc2.addStream(this.configuration.mediaStream);
|
|
||||||
} else {
|
|
||||||
for (const track of this.configuration.mediaStream.getTracks()) {
|
|
||||||
this.pc.addTrack(track, this.configuration.mediaStream);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
|
@ -112,41 +106,21 @@ export class WebRtcPeer {
|
||||||
}
|
}
|
||||||
this.remoteCandidatesQueue = [];
|
this.remoteCandidatesQueue = [];
|
||||||
this.localCandidatesQueue = [];
|
this.localCandidatesQueue = [];
|
||||||
|
// Stop senders
|
||||||
if (platform['isIonicIos']) {
|
for (const sender of this.pc.getSenders()) {
|
||||||
// iOS Ionic. LIMITATION: must use deprecated WebRTC API
|
if (!videoSourceIsMediaStreamTrack) {
|
||||||
// Stop senders deprecated
|
if (!!sender.track) {
|
||||||
const pc1: any = this.pc;
|
sender.track.stop();
|
||||||
for (const sender of pc1.getLocalStreams()) {
|
|
||||||
if (!videoSourceIsMediaStreamTrack) {
|
|
||||||
sender.stop();
|
|
||||||
}
|
|
||||||
pc1.removeStream(sender);
|
|
||||||
}
|
|
||||||
// Stop receivers deprecated
|
|
||||||
for (const receiver of pc1.getRemoteStreams()) {
|
|
||||||
if (!!receiver.track) {
|
|
||||||
receiver.stop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
this.pc.removeTrack(sender);
|
||||||
// Stop senders
|
}
|
||||||
for (const sender of this.pc.getSenders()) {
|
// Stop receivers
|
||||||
if (!videoSourceIsMediaStreamTrack) {
|
for (const receiver of this.pc.getReceivers()) {
|
||||||
if (!!sender.track) {
|
if (!!receiver.track) {
|
||||||
sender.track.stop();
|
receiver.track.stop();
|
||||||
}
|
|
||||||
}
|
|
||||||
this.pc.removeTrack(sender);
|
|
||||||
}
|
|
||||||
// Stop receivers
|
|
||||||
for (const receiver of this.pc.getReceivers()) {
|
|
||||||
if (!!receiver.track) {
|
|
||||||
receiver.track.stop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pc.close();
|
this.pc.close();
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Reference in New Issue