mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: rename WebRtcPeer handler methods
parent
9fff788546
commit
ac0e93ea27
|
@ -814,8 +814,8 @@ export class Stream {
|
||||||
const options: WebRtcPeerConfiguration = {
|
const options: WebRtcPeerConfiguration = {
|
||||||
mediaStream: this.mediaStream,
|
mediaStream: this.mediaStream,
|
||||||
mediaConstraints: userMediaConstraints,
|
mediaConstraints: userMediaConstraints,
|
||||||
onicecandidate: this.connection.sendIceCandidate.bind(this.connection),
|
onIceCandidate: this.connection.sendIceCandidate.bind(this.connection),
|
||||||
onexception: (exceptionName: ExceptionEventName, message: string, data?: any) => { this.session.emitEvent('exception', [new ExceptionEvent(this.session, exceptionName, this, message, data)]) },
|
onIceConnectionStateException: this.onIceConnectionStateExceptionHandler.bind(this),
|
||||||
iceServers: this.getIceServersConf(),
|
iceServers: this.getIceServersConf(),
|
||||||
simulcast: false
|
simulcast: false
|
||||||
};
|
};
|
||||||
|
@ -943,9 +943,9 @@ export class Stream {
|
||||||
logger.debug("'Session.subscribe(Stream)' called. Constraints of generate SDP offer",
|
logger.debug("'Session.subscribe(Stream)' called. Constraints of generate SDP offer",
|
||||||
offerConstraints);
|
offerConstraints);
|
||||||
const options = {
|
const options = {
|
||||||
onicecandidate: this.connection.sendIceCandidate.bind(this.connection),
|
|
||||||
onexception: (exceptionName: ExceptionEventName, message: string, data?: any) => { this.session.emitEvent('exception', [new ExceptionEvent(this.session, exceptionName, this, message, data)]) },
|
|
||||||
mediaConstraints: offerConstraints,
|
mediaConstraints: offerConstraints,
|
||||||
|
onIceCandidate: this.connection.sendIceCandidate.bind(this.connection),
|
||||||
|
onIceConnectionStateException: this.onIceConnectionStateExceptionHandler.bind(this),
|
||||||
iceServers: this.getIceServersConf(),
|
iceServers: this.getIceServersConf(),
|
||||||
simulcast: false
|
simulcast: false
|
||||||
};
|
};
|
||||||
|
@ -968,6 +968,9 @@ export class Stream {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (reconnect) {
|
||||||
|
this.disposeWebRtcPeer();
|
||||||
|
}
|
||||||
this.webRtcPeer = new WebRtcPeerRecvonly(options);
|
this.webRtcPeer = new WebRtcPeerRecvonly(options);
|
||||||
this.webRtcPeer.addIceConnectionStateChangeListener(this.streamId);
|
this.webRtcPeer.addIceConnectionStateChangeListener(this.streamId);
|
||||||
this.webRtcPeer.processRemoteOffer(sdpOffer)
|
this.webRtcPeer.processRemoteOffer(sdpOffer)
|
||||||
|
|
|
@ -37,8 +37,8 @@ export interface WebRtcPeerConfiguration {
|
||||||
video: boolean
|
video: boolean
|
||||||
};
|
};
|
||||||
simulcast: boolean;
|
simulcast: boolean;
|
||||||
onicecandidate: (event: RTCIceCandidate) => void;
|
onIceCandidate: (event: RTCIceCandidate) => void;
|
||||||
onexception: (exceptionName: ExceptionEventName, message: string, data?: any) => void;
|
onIceConnectionStateException: (exceptionName: ExceptionEventName, message: string, data?: any) => void;
|
||||||
iceServers: RTCIceServer[] | undefined;
|
iceServers: RTCIceServer[] | undefined;
|
||||||
mediaStream?: MediaStream;
|
mediaStream?: MediaStream;
|
||||||
mode?: 'sendonly' | 'recvonly' | 'sendrecv';
|
mode?: 'sendonly' | 'recvonly' | 'sendrecv';
|
||||||
|
@ -64,7 +64,7 @@ export class WebRtcPeer {
|
||||||
this.pc.addEventListener('icecandidate', (event: RTCPeerConnectionIceEvent) => {
|
this.pc.addEventListener('icecandidate', (event: RTCPeerConnectionIceEvent) => {
|
||||||
if (event.candidate != null) {
|
if (event.candidate != null) {
|
||||||
const candidate: RTCIceCandidate = event.candidate;
|
const candidate: RTCIceCandidate = event.candidate;
|
||||||
this.configuration.onicecandidate(candidate);
|
this.configuration.onIceCandidate(candidate);
|
||||||
if (candidate.candidate !== '') {
|
if (candidate.candidate !== '') {
|
||||||
this.localCandidatesQueue.push(<RTCIceCandidate>{ candidate: candidate.candidate });
|
this.localCandidatesQueue.push(<RTCIceCandidate>{ candidate: candidate.candidate });
|
||||||
}
|
}
|
||||||
|
@ -326,12 +326,12 @@ export class WebRtcPeer {
|
||||||
// Possible network disconnection
|
// Possible network disconnection
|
||||||
const msg1 = '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);
|
logger.warn(msg1);
|
||||||
this.configuration.onexception(ExceptionEventName.ICE_CONNECTION_DISCONNECTED, msg1);
|
this.configuration.onIceConnectionStateException(ExceptionEventName.ICE_CONNECTION_DISCONNECTED, msg1);
|
||||||
break;
|
break;
|
||||||
case 'failed':
|
case 'failed':
|
||||||
const msg2 = 'IceConnectionState of RTCPeerConnection ' + this.id + ' (' + otherId + ') to "failed"';
|
const msg2 = 'IceConnectionState of RTCPeerConnection ' + this.id + ' (' + otherId + ') to "failed"';
|
||||||
logger.error(msg2);
|
logger.error(msg2);
|
||||||
this.configuration.onexception(ExceptionEventName.ICE_CONNECTION_FAILED, msg2);
|
this.configuration.onIceConnectionStateException(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"');
|
||||||
|
|
Loading…
Reference in New Issue