openvidu-browser: old fix for iosIonic processAnswer removed

pull/375/head
pabloFuente 2019-06-06 18:14:36 +02:00
parent f28f006370
commit 0b22c295ee
3 changed files with 4 additions and 30 deletions

View File

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

View File

@ -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();

View File

@ -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<string> {
processAnswer(sdpAnswer: string): Promise<string> {
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));