openvidu-browser: removed Ionic iOS timeout on first subscription

pull/600/head
pabloFuente 2020-09-02 13:29:25 +02:00
parent 4ea531a379
commit 23d64be806
3 changed files with 4 additions and 58 deletions

View File

@ -99,14 +99,6 @@ export class Session extends EventDispatcher {
*/
remoteStreamsCreated: ObjMap<boolean> = {};
/**
* @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 => {

View File

@ -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);
// });
}
});
};

View File

@ -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<void> {
// 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<void> {
return this.pc.setRemoteDescription(sdp);
}
/**