mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: old fix for iosIonic processAnswer removed
parent
f28f006370
commit
0b22c295ee
|
@ -77,15 +77,6 @@ export class Session implements EventDispatcher {
|
||||||
*/
|
*/
|
||||||
remoteStreamsCreated: ObjMap<boolean> = {};
|
remoteStreamsCreated: ObjMap<boolean> = {};
|
||||||
|
|
||||||
/**
|
|
||||||
* @hidden
|
|
||||||
*/
|
|
||||||
isFirstIonicIosSubscriber = true;
|
|
||||||
/**
|
|
||||||
* @hidden
|
|
||||||
*/
|
|
||||||
countDownForIonicIosSubscribers = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
|
@ -674,10 +665,6 @@ export class Session implements EventDispatcher {
|
||||||
streamEvent.callDefaultBehavior();
|
streamEvent.callDefaultBehavior();
|
||||||
|
|
||||||
delete this.remoteStreamsCreated[stream.streamId];
|
delete this.remoteStreamsCreated[stream.streamId];
|
||||||
if (Object.keys(this.remoteStreamsCreated).length === 0) {
|
|
||||||
this.isFirstIonicIosSubscriber = true;
|
|
||||||
this.countDownForIonicIosSubscribers = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
delete this.remoteConnections[connection.connectionId];
|
delete this.remoteConnections[connection.connectionId];
|
||||||
this.ee.emitEvent('connectionDestroyed', [new ConnectionEvent(false, this, 'connectionDestroyed', connection, msg.reason)]);
|
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
|
// Deleting the remote stream
|
||||||
const streamId: string = connection.stream.streamId;
|
const streamId: string = connection.stream.streamId;
|
||||||
delete this.remoteStreamsCreated[streamId];
|
delete this.remoteStreamsCreated[streamId];
|
||||||
if (Object.keys(this.remoteStreamsCreated).length === 0) {
|
|
||||||
this.isFirstIonicIosSubscriber = true;
|
|
||||||
this.countDownForIonicIosSubscribers = true;
|
|
||||||
}
|
|
||||||
connection.removeStream(streamId);
|
connection.removeStream(streamId);
|
||||||
})
|
})
|
||||||
.catch(openViduError => {
|
.catch(openViduError => {
|
||||||
|
|
|
@ -718,7 +718,7 @@ export class Stream implements EventDispatcher {
|
||||||
reject('Error on publishVideo: ' + JSON.stringify(error));
|
reject('Error on publishVideo: ' + JSON.stringify(error));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.webRtcPeer.processAnswer(response.sdpAnswer, false)
|
this.webRtcPeer.processAnswer(response.sdpAnswer)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.streamId = response.id;
|
this.streamId = response.id;
|
||||||
this.creationTime = response.createdAt;
|
this.creationTime = response.createdAt;
|
||||||
|
@ -778,16 +778,7 @@ export class Stream implements EventDispatcher {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(new Error('Error on recvVideoFrom: ' + JSON.stringify(error)));
|
reject(new Error('Error on recvVideoFrom: ' + JSON.stringify(error)));
|
||||||
} else {
|
} else {
|
||||||
// Ios Ionic. Limitation: some bug in iosrtc cordova plugin makes
|
this.webRtcPeer.processAnswer(response.sdpAnswer).then(() => {
|
||||||
// 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.remotePeerSuccessfullyEstablished();
|
this.remotePeerSuccessfullyEstablished();
|
||||||
this.initWebRtcStats();
|
this.initWebRtcStats();
|
||||||
resolve();
|
resolve();
|
||||||
|
|
|
@ -234,7 +234,7 @@ export class WebRtcPeer {
|
||||||
* Function invoked when a SDP answer is received. Final step in SDP negotiation, the peer
|
* 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
|
* 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) => {
|
return new Promise((resolve, reject) => {
|
||||||
const answer: RTCSessionDescriptionInit = {
|
const answer: RTCSessionDescriptionInit = {
|
||||||
type: 'answer',
|
type: 'answer',
|
||||||
|
@ -245,7 +245,7 @@ export class WebRtcPeer {
|
||||||
if (this.pc.signalingState === 'closed') {
|
if (this.pc.signalingState === 'closed') {
|
||||||
reject('RTCPeerConnection is closed');
|
reject('RTCPeerConnection is closed');
|
||||||
}
|
}
|
||||||
if (needsTimeoutOnProcessAswer && platform['isIonicIos']) {
|
if (platform['isIonicIos']) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
console.info('setRemoteDescription run after timout for iOS device');
|
console.info('setRemoteDescription run after timout for iOS device');
|
||||||
this.pc.setRemoteDescription(answer).then(() => resolve()).catch(error => reject(error));
|
this.pc.setRemoteDescription(answer).then(() => resolve()).catch(error => reject(error));
|
||||||
|
|
Loading…
Reference in New Issue