diff --git a/openvidu-browser/src/OpenVidu/Session.ts b/openvidu-browser/src/OpenVidu/Session.ts index a719044e..032d24e3 100644 --- a/openvidu-browser/src/OpenVidu/Session.ts +++ b/openvidu-browser/src/OpenVidu/Session.ts @@ -77,15 +77,6 @@ export class Session implements EventDispatcher { */ remoteStreamsCreated: ObjMap = {}; - /** - * @hidden - */ - isFirstIonicIosSubscriber = true; - /** - * @hidden - */ - countDownForIonicIosSubscribers = true; - /** * @hidden */ @@ -674,10 +665,6 @@ export class Session implements EventDispatcher { streamEvent.callDefaultBehavior(); delete this.remoteStreamsCreated[stream.streamId]; - if (Object.keys(this.remoteStreamsCreated).length === 0) { - this.isFirstIonicIosSubscriber = true; - this.countDownForIonicIosSubscribers = true; - } } delete this.remoteConnections[connection.connectionId]; this.ee.emitEvent('connectionDestroyed', [new ConnectionEvent(false, this, 'connectionDestroyed', connection, msg.reason)]); @@ -747,10 +734,6 @@ export class Session implements 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.countDownForIonicIosSubscribers = true; - } connection.removeStream(streamId); }) .catch(openViduError => { diff --git a/openvidu-browser/src/OpenVidu/Stream.ts b/openvidu-browser/src/OpenVidu/Stream.ts index b58a7411..de2b214f 100644 --- a/openvidu-browser/src/OpenVidu/Stream.ts +++ b/openvidu-browser/src/OpenVidu/Stream.ts @@ -718,7 +718,7 @@ export class Stream implements EventDispatcher { reject('Error on publishVideo: ' + JSON.stringify(error)); } } else { - this.webRtcPeer.processAnswer(response.sdpAnswer, false) + this.webRtcPeer.processAnswer(response.sdpAnswer) .then(() => { this.streamId = response.id; this.creationTime = response.createdAt; @@ -778,16 +778,7 @@ export class Stream implements EventDispatcher { if (error) { reject(new Error('Error on recvVideoFrom: ' + JSON.stringify(error))); } else { - // Ios Ionic. Limitation: some bug in iosrtc cordova plugin makes - // it necessary to add a timeout before processAnswer method - if (this.session.isFirstIonicIosSubscriber) { - this.session.isFirstIonicIosSubscriber = false; - this.session['iosInterval'] = setTimeout(() => { - this.session.countDownForIonicIosSubscribers = false; - }, 400); - } - const needsTimeoutOnProcessAswer = this.session.countDownForIonicIosSubscribers; - this.webRtcPeer.processAnswer(response.sdpAnswer, needsTimeoutOnProcessAswer).then(() => { + this.webRtcPeer.processAnswer(response.sdpAnswer).then(() => { this.remotePeerSuccessfullyEstablished(); this.initWebRtcStats(); resolve(); diff --git a/openvidu-browser/src/OpenViduInternal/WebRtcPeer/WebRtcPeer.ts b/openvidu-browser/src/OpenViduInternal/WebRtcPeer/WebRtcPeer.ts index dd80468c..e2b69f8f 100644 --- a/openvidu-browser/src/OpenViduInternal/WebRtcPeer/WebRtcPeer.ts +++ b/openvidu-browser/src/OpenViduInternal/WebRtcPeer/WebRtcPeer.ts @@ -234,7 +234,7 @@ export class WebRtcPeer { * Function invoked when a SDP answer is received. Final step in SDP negotiation, the peer * just needs to set the answer as its remote description */ - processAnswer(sdpAnswer: string, needsTimeoutOnProcessAswer: boolean): Promise { + processAnswer(sdpAnswer: string): Promise { return new Promise((resolve, reject) => { const answer: RTCSessionDescriptionInit = { type: 'answer', @@ -245,7 +245,7 @@ export class WebRtcPeer { if (this.pc.signalingState === 'closed') { reject('RTCPeerConnection is closed'); } - if (needsTimeoutOnProcessAswer && platform['isIonicIos']) { + if (platform['isIonicIos']) { setTimeout(() => { console.info('setRemoteDescription run after timout for iOS device'); this.pc.setRemoteDescription(answer).then(() => resolve()).catch(error => reject(error));