mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 20:27:34 +08:00
更新zlmrtcclient.js 播放客户端,增加状态改变通知
This commit is contained in:
parent
afc7b019f1
commit
c22644af12
@ -7,11 +7,12 @@ var ZLMRTCClient = (function (exports) {
|
||||
WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED: 'WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED',
|
||||
WEBRTC_ON_REMOTE_STREAMS: 'WEBRTC_ON_REMOTE_STREAMS',
|
||||
WEBRTC_ON_LOCAL_STREAM: 'WEBRTC_ON_LOCAL_STREAM',
|
||||
WEBRTC_ON_CONNECTION_STATE_CHANGE: 'WEBRTC_ON_CONNECTION_STATE_CHANGE',
|
||||
CAPTURE_STREAM_FAILED: 'CAPTURE_STREAM_FAILED'
|
||||
};
|
||||
|
||||
const VERSION = '1.0.1';
|
||||
const BUILD_DATE = 'Fri Sep 17 2021 10:41:58 GMT+0800 (China Standard Time)';
|
||||
const BUILD_DATE = 'Sat Jan 08 2022 15:24:38 GMT+0800 (China Standard Time)';
|
||||
|
||||
// Copyright (C) <2018> Intel Corporation
|
||||
//
|
||||
@ -7304,7 +7305,8 @@ var ZLMRTCClient = (function (exports) {
|
||||
this.e = {
|
||||
onicecandidate: this._onIceCandidate.bind(this),
|
||||
ontrack: this._onTrack.bind(this),
|
||||
onicecandidateerror: this._onIceCandidateError.bind(this)
|
||||
onicecandidateerror: this._onIceCandidateError.bind(this),
|
||||
onconnectionstatechange: this._onconnectionstatechange.bind(this)
|
||||
};
|
||||
this._remoteStream = null;
|
||||
this._localStream = null;
|
||||
@ -7312,6 +7314,7 @@ var ZLMRTCClient = (function (exports) {
|
||||
this.pc.onicecandidate = this.e.onicecandidate;
|
||||
this.pc.onicecandidateerror = this.e.onicecandidateerror;
|
||||
this.pc.ontrack = this.e.ontrack;
|
||||
this.pc.onconnectionstatechange = this.e.onconnectionstatechange;
|
||||
if (!this.options.recvOnly && (this.options.audioEnable || this.options.videoEnable)) this.start();else this.receive();
|
||||
}
|
||||
|
||||
@ -7507,6 +7510,10 @@ var ZLMRTCClient = (function (exports) {
|
||||
this.dispatch(Events$1.WEBRTC_ICE_CANDIDATE_ERROR, event);
|
||||
}
|
||||
|
||||
_onconnectionstatechange(event) {
|
||||
this.dispatch(Events$1.WEBRTC_ON_CONNECTION_STATE_CHANGE, this.pc.connectionState);
|
||||
}
|
||||
|
||||
close() {
|
||||
if (this.pc) {
|
||||
this.pc.close();
|
||||
|
File diff suppressed because one or more lines are too long
@ -7,11 +7,12 @@ var ZLMRTCClient = (function (exports) {
|
||||
WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED: 'WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED',
|
||||
WEBRTC_ON_REMOTE_STREAMS: 'WEBRTC_ON_REMOTE_STREAMS',
|
||||
WEBRTC_ON_LOCAL_STREAM: 'WEBRTC_ON_LOCAL_STREAM',
|
||||
WEBRTC_ON_CONNECTION_STATE_CHANGE: 'WEBRTC_ON_CONNECTION_STATE_CHANGE',
|
||||
CAPTURE_STREAM_FAILED: 'CAPTURE_STREAM_FAILED'
|
||||
};
|
||||
|
||||
const VERSION = '1.0.1';
|
||||
const BUILD_DATE = 'Fri Sep 17 2021 10:41:58 GMT+0800 (China Standard Time)';
|
||||
const BUILD_DATE = 'Sat Jan 08 2022 15:24:38 GMT+0800 (China Standard Time)';
|
||||
|
||||
// Copyright (C) <2018> Intel Corporation
|
||||
//
|
||||
@ -7304,7 +7305,8 @@ var ZLMRTCClient = (function (exports) {
|
||||
this.e = {
|
||||
onicecandidate: this._onIceCandidate.bind(this),
|
||||
ontrack: this._onTrack.bind(this),
|
||||
onicecandidateerror: this._onIceCandidateError.bind(this)
|
||||
onicecandidateerror: this._onIceCandidateError.bind(this),
|
||||
onconnectionstatechange: this._onconnectionstatechange.bind(this)
|
||||
};
|
||||
this._remoteStream = null;
|
||||
this._localStream = null;
|
||||
@ -7312,6 +7314,7 @@ var ZLMRTCClient = (function (exports) {
|
||||
this.pc.onicecandidate = this.e.onicecandidate;
|
||||
this.pc.onicecandidateerror = this.e.onicecandidateerror;
|
||||
this.pc.ontrack = this.e.ontrack;
|
||||
this.pc.onconnectionstatechange = this.e.onconnectionstatechange;
|
||||
if (!this.options.recvOnly && (this.options.audioEnable || this.options.videoEnable)) this.start();else this.receive();
|
||||
}
|
||||
|
||||
@ -7507,6 +7510,10 @@ var ZLMRTCClient = (function (exports) {
|
||||
this.dispatch(Events$1.WEBRTC_ICE_CANDIDATE_ERROR, event);
|
||||
}
|
||||
|
||||
_onconnectionstatechange(event) {
|
||||
this.dispatch(Events$1.WEBRTC_ON_CONNECTION_STATE_CHANGE, this.pc.connectionState);
|
||||
}
|
||||
|
||||
close() {
|
||||
if (this.pc) {
|
||||
this.pc.close();
|
||||
|
File diff suppressed because one or more lines are too long
@ -159,6 +159,11 @@
|
||||
|
||||
console.log('获取本地流失败')
|
||||
});
|
||||
|
||||
player.on(ZLMRTCClient.Events.WEBRTC_ON_CONNECTION_STATE_CHANGE,function(state)
|
||||
{// RTC 状态变化 ,详情参考 https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/connectionState
|
||||
console.log('当前状态==>',state)
|
||||
});
|
||||
}
|
||||
|
||||
function start()
|
||||
|
Loading…
Reference in New Issue
Block a user