mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: extend ExceptionEvent with ICE_CONNECTION_DISCONNECTED
parent
e32385fc85
commit
5de36ddb15
|
@ -36,9 +36,22 @@ export enum ExceptionEventName {
|
||||||
* The [ICE connection state](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/iceConnectionState)
|
* The [ICE connection state](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/iceConnectionState)
|
||||||
* of an [RTCPeerConnection](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection) reached `failed` status.
|
* of an [RTCPeerConnection](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection) reached `failed` status.
|
||||||
*
|
*
|
||||||
|
* This is a terminal error that won't have any kind of possible recovery.
|
||||||
|
*
|
||||||
* [[ExceptionEvent]] objects with this [[ExceptionEvent.name]] will have as [[ExceptionEvent.origin]] property a [[Stream]] object.
|
* [[ExceptionEvent]] objects with this [[ExceptionEvent.name]] will have as [[ExceptionEvent.origin]] property a [[Stream]] object.
|
||||||
*/
|
*/
|
||||||
ICE_CONNECTION_FAILED = 'ICE_CONNECTION_FAILED'
|
ICE_CONNECTION_FAILED = 'ICE_CONNECTION_FAILED',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The [ICE connection state](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/iceConnectionState)
|
||||||
|
* of an [RTCPeerConnection](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection) reached `disconnected` status.
|
||||||
|
*
|
||||||
|
* This is not a terminal error, and it is possible for the ICE connection to be reconnected.
|
||||||
|
*
|
||||||
|
* [[ExceptionEvent]] objects with this [[ExceptionEvent.name]] will have as [[ExceptionEvent.origin]] property a [[Stream]] object.
|
||||||
|
*/
|
||||||
|
ICE_CONNECTION_DISCONNECTED = 'ICE_CONNECTION_DISCONNECTED'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +69,7 @@ export class ExceptionEvent extends Event {
|
||||||
/**
|
/**
|
||||||
* Object affected by the exception. Depending on the [[ExceptionEvent.name]] property:
|
* Object affected by the exception. Depending on the [[ExceptionEvent.name]] property:
|
||||||
* - [[Session]]: `ICE_CANDIDATE_ERROR`
|
* - [[Session]]: `ICE_CANDIDATE_ERROR`
|
||||||
* - [[Stream]]: `ICE_CONNECTION_FAILED`
|
* - [[Stream]]: `ICE_CONNECTION_FAILED`, `ICE_CONNECTION_DISCONNECTED`
|
||||||
*/
|
*/
|
||||||
origin: Session | Stream;
|
origin: Session | Stream;
|
||||||
|
|
||||||
|
|
|
@ -324,12 +324,14 @@ export class WebRtcPeer {
|
||||||
switch (iceConnectionState) {
|
switch (iceConnectionState) {
|
||||||
case 'disconnected':
|
case 'disconnected':
|
||||||
// Possible network disconnection
|
// Possible network disconnection
|
||||||
logger.warn('IceConnectionState of RTCPeerConnection ' + this.id + ' (' + otherId + ') change to "disconnected". Possible network disconnection');
|
const msg1 = 'IceConnectionState of RTCPeerConnection ' + this.id + ' (' + otherId + ') change to "disconnected". Possible network disconnection';
|
||||||
|
logger.warn(msg1);
|
||||||
|
this.configuration.onexception(ExceptionEventName.ICE_CONNECTION_DISCONNECTED, msg1);
|
||||||
break;
|
break;
|
||||||
case 'failed':
|
case 'failed':
|
||||||
const msg = 'IceConnectionState of RTCPeerConnection ' + this.id + ' (' + otherId + ') to "failed"';
|
const msg2 = 'IceConnectionState of RTCPeerConnection ' + this.id + ' (' + otherId + ') to "failed"';
|
||||||
logger.error(msg);
|
logger.error(msg2);
|
||||||
this.configuration.onexception(ExceptionEventName.ICE_CONNECTION_FAILED, msg);
|
this.configuration.onexception(ExceptionEventName.ICE_CONNECTION_FAILED, msg2);
|
||||||
break;
|
break;
|
||||||
case 'closed':
|
case 'closed':
|
||||||
logger.log('IceConnectionState of RTCPeerConnection ' + this.id + ' (' + otherId + ') change to "closed"');
|
logger.log('IceConnectionState of RTCPeerConnection ' + this.id + ' (' + otherId + ') change to "closed"');
|
||||||
|
|
|
@ -25,6 +25,7 @@ export { StreamPropertyChangedEvent } from './OpenViduInternal/Events/StreamProp
|
||||||
export { ConnectionPropertyChangedEvent } from './OpenViduInternal/Events/ConnectionPropertyChangedEvent';
|
export { ConnectionPropertyChangedEvent } from './OpenViduInternal/Events/ConnectionPropertyChangedEvent';
|
||||||
export { FilterEvent } from './OpenViduInternal/Events/FilterEvent';
|
export { FilterEvent } from './OpenViduInternal/Events/FilterEvent';
|
||||||
export { NetworkQualityLevelChangedEvent } from './OpenViduInternal/Events/NetworkQualityLevelChangedEvent';
|
export { NetworkQualityLevelChangedEvent } from './OpenViduInternal/Events/NetworkQualityLevelChangedEvent';
|
||||||
|
export { ExceptionEvent } from './OpenViduInternal/Events/ExceptionEvent';
|
||||||
|
|
||||||
export { Capabilities } from './OpenViduInternal/Interfaces/Public/Capabilities';
|
export { Capabilities } from './OpenViduInternal/Interfaces/Public/Capabilities';
|
||||||
export { Device } from './OpenViduInternal/Interfaces/Public/Device';
|
export { Device } from './OpenViduInternal/Interfaces/Public/Device';
|
||||||
|
|
Loading…
Reference in New Issue