diff --git a/openvidu-browser/src/OpenVidu/Session.ts b/openvidu-browser/src/OpenVidu/Session.ts index 61f50bc9..a02f8c1c 100644 --- a/openvidu-browser/src/OpenVidu/Session.ts +++ b/openvidu-browser/src/OpenVidu/Session.ts @@ -99,14 +99,6 @@ export class Session extends EventDispatcher { */ remoteStreamsCreated: ObjMap = {}; - /** - * @hidden - */ - isFirstIonicIosSubscriber = true; - /** - * @hidden - */ - countDownForIonicIosSubscribersActive = true; /** * @hidden */ @@ -724,11 +716,6 @@ export class Session extends EventDispatcher { streamEvent.callDefaultBehavior(); delete this.remoteStreamsCreated[stream.streamId]; - - if (Object.keys(this.remoteStreamsCreated).length === 0) { - this.isFirstIonicIosSubscriber = true; - this.countDownForIonicIosSubscribersActive = true; - } } delete this.remoteConnections[connection.connectionId]; this.ee.emitEvent('connectionDestroyed', [new ConnectionEvent(false, this, 'connectionDestroyed', connection, msg.reason)]); @@ -798,12 +785,6 @@ export class Session extends EventDispatcher { // Deleting the remote stream const streamId: string = connection.stream.streamId; delete this.remoteStreamsCreated[streamId]; - - if (Object.keys(this.remoteStreamsCreated).length === 0) { - this.isFirstIonicIosSubscriber = true; - this.countDownForIonicIosSubscribersActive = true; - } - connection.removeStream(streamId); }) .catch(openViduError => { diff --git a/openvidu-browser/src/OpenVidu/Stream.ts b/openvidu-browser/src/OpenVidu/Stream.ts index 9178f3af..d973a438 100644 --- a/openvidu-browser/src/OpenVidu/Stream.ts +++ b/openvidu-browser/src/OpenVidu/Stream.ts @@ -965,26 +965,6 @@ export class Stream extends EventDispatcher { reject(new Error('Error on receiveVideFrom: ' + JSON.stringify(error))); } else { resolve(); - // // Ios Ionic. Limitation: some bug in iosrtc cordova plugin makes it necessary - // // to add a timeout before calling PeerConnection#setRemoteDescription during - // // some time (400 ms) from the moment first subscriber stream is received - // if (this.session.isFirstIonicIosSubscriber) { - // this.session.isFirstIonicIosSubscriber = false; - // setTimeout(() => { - // // After 400 ms Ionic iOS subscribers won't need to run - // // PeerConnection#setRemoteDescription after 250 ms timeout anymore - // this.session.countDownForIonicIosSubscribersActive = false; - // }, 400); - // } - // const needsTimeoutOnProcessAnswer = this.session.countDownForIonicIosSubscribersActive; - // this.webRtcPeer.processAnswer(response.sdpAnswer, needsTimeoutOnProcessAnswer).then(() => { - // logger.info("'Subscriber' (" + this.streamId + ") successfully " + (reconnect ? "reconnected" : "subscribed")); - // this.remotePeerSuccessfullyEstablished(); - // this.initWebRtcStats(); - // resolve(); - // }).catch(error => { - // reject(error); - // }); } }); }; diff --git a/openvidu-browser/src/OpenViduInternal/WebRtcPeer/WebRtcPeer.ts b/openvidu-browser/src/OpenViduInternal/WebRtcPeer/WebRtcPeer.ts index c4141973..b36488d2 100644 --- a/openvidu-browser/src/OpenViduInternal/WebRtcPeer/WebRtcPeer.ts +++ b/openvidu-browser/src/OpenViduInternal/WebRtcPeer/WebRtcPeer.ts @@ -232,8 +232,7 @@ export class WebRtcPeer { if (this.pc.signalingState === 'closed') { reject('RTCPeerConnection is closed when trying to set remote description'); } - // TODO: check if Ionic iOS still needs timeout on setting first remote description when subscribing - this.setRemoteDescription(offer, false) + this.setRemoteDescription(offer) .then(() => { resolve(); }) @@ -272,7 +271,7 @@ export class WebRtcPeer { if (this.pc.signalingState === 'closed') { reject('RTCPeerConnection is closed when trying to set remote description'); } - this.setRemoteDescription(answer, false) + this.setRemoteDescription(answer) .then(() => resolve()) .catch(error => reject(error)); }); @@ -281,22 +280,8 @@ export class WebRtcPeer { /** * @hidden */ - async setRemoteDescription(sdp: RTCSessionDescriptionInit, needsTimeoutOnProcessAnswer: boolean): Promise { - // if (platform['isIonicIos']) { - // // Ionic iOS platform - // if (needsTimeoutOnProcessAnswer) { - // // 400 ms have not elapsed yet since first remote stream triggered Stream#initWebRtcPeerReceive - // await new Promise(resolve => setTimeout(resolve, 250)); // Sleep for 250ms - // logger.info('setRemoteDescription run after timeout for Ionic iOS device'); - // return this.pc.setRemoteDescription(sdp); - // } else { - // // 400 ms have elapsed - // return this.pc.setRemoteDescription(sdp); - // } - // } else { - // Rest of platforms - return this.pc.setRemoteDescription(sdp); - // } + async setRemoteDescription(sdp: RTCSessionDescriptionInit): Promise { + return this.pc.setRemoteDescription(sdp); } /**