mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: fix unexpected undefined exception on reconnected callback
parent
a852a826fa
commit
12f215ddd9
|
@ -337,8 +337,8 @@ export class OpenVidu {
|
|||
const family = platform.os!!.family;
|
||||
const userAgent = !!platform.ua ? platform.ua : navigator.userAgent;
|
||||
|
||||
if(this.isIPhoneOrIPad(userAgent)) {
|
||||
if(this.isIOSWithSafari(userAgent) || platform['isIonicIos']){
|
||||
if (this.isIPhoneOrIPad(userAgent)) {
|
||||
if (this.isIOSWithSafari(userAgent) || platform['isIonicIos']) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1025,6 +1025,7 @@ export class OpenVidu {
|
|||
private reconnectedCallback(): void {
|
||||
logger.warn('Websocket reconnected');
|
||||
if (this.isRoomAvailable()) {
|
||||
if (!!this.session.connection) {
|
||||
this.sendRequest('connect', { sessionId: this.session.connection.rpcSessionId }, (error, response) => {
|
||||
if (!!error) {
|
||||
logger.error(error);
|
||||
|
@ -1036,6 +1037,9 @@ export class OpenVidu {
|
|||
this.session.onRecoveredConnection();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
logger.warn('There was no previous connection when running reconnection callback');
|
||||
}
|
||||
} else {
|
||||
alert('Connection error. Please reload page.');
|
||||
}
|
||||
|
@ -1064,7 +1068,7 @@ export class OpenVidu {
|
|||
return isIPad || isIPhone;
|
||||
}
|
||||
|
||||
private isIOSWithSafari(userAgent): boolean{
|
||||
private isIOSWithSafari(userAgent): boolean {
|
||||
return /\b(\w*Apple\w*)\b/.test(navigator.vendor) && /\b(\w*Safari\w*)\b/.test(userAgent)
|
||||
&& !/\b(\w*CriOS\w*)\b/.test(userAgent) && !/\b(\w*FxiOS\w*)\b/.test(userAgent);
|
||||
}
|
||||
|
|
|
@ -987,7 +987,7 @@ export class Session extends EventDispatcher {
|
|||
*/
|
||||
onLostConnection(reason: string): void {
|
||||
logger.warn('Lost connection in Session ' + this.sessionId);
|
||||
if (!!this.sessionId && !this.connection.disposed) {
|
||||
if (!!this.sessionId && !!this.connection && !this.connection.disposed) {
|
||||
this.leave(true, reason);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue