Merge pull request #921 from johzzy/johnny/dev

This commit is contained in:
Xiaofeng Wang 2021-06-20 09:10:08 +08:00 committed by GitHub
commit 25b2208f34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 34 deletions

View File

@ -390,7 +390,7 @@ string RtpExt::getSdesMid() const {
//https://tools.ietf.org/html/draft-ietf-avtext-rid-06 //https://tools.ietf.org/html/draft-ietf-avtext-rid-06
//用于simulecast //用于simulcast
//3.1. RTCP 'RtpStreamId' SDES Extension //3.1. RTCP 'RtpStreamId' SDES Extension
// //
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

View File

@ -31,7 +31,7 @@ ZLMediaKit的WebRTC相关功能目前仅供测试与开发现在还不成熟
- 1、完善webrtc rtcp相关功能包括丢包重传、带宽检测等功能。 - 1、完善webrtc rtcp相关功能包括丢包重传、带宽检测等功能。
- 2、实现rtp重传等相关功能。 - 2、实现rtp重传等相关功能。
- 3、实现simulecast相关功能。 - 3、实现simulcast相关功能。
- 4、fec、rtp扩展等其他功能。 - 4、fec、rtp扩展等其他功能。
- 5、如果精力允许逐步替换MediaSoup相关代码改用自有版权代码。 - 5、如果精力允许逐步替换MediaSoup相关代码改用自有版权代码。

View File

@ -4,7 +4,7 @@ var ZLMRTCClient = (function (exports) {
const Events$1 = { const Events$1 = {
WEBRTC_NOT_SUPPORT: 'WEBRTC_NOT_SUPPORT', WEBRTC_NOT_SUPPORT: 'WEBRTC_NOT_SUPPORT',
WEBRTC_ICE_CANDIDATE_ERROR: 'WEBRTC_ICE_CANDIDATE_ERROR', WEBRTC_ICE_CANDIDATE_ERROR: 'WEBRTC_ICE_CANDIDATE_ERROR',
WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED: 'WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED', WEBRTC_OFFER_ANSWER_EXCHANGE_FAILED: 'WEBRTC_OFFER_ANSWER_EXCHANGE_FAILED',
WEBRTC_ON_REMOTE_STREAMS: 'WEBRTC_ON_REMOTE_STREAMS', WEBRTC_ON_REMOTE_STREAMS: 'WEBRTC_ON_REMOTE_STREAMS',
WEBRTC_ON_LOCAL_STREAM: 'WEBRTC_ON_LOCAL_STREAM', WEBRTC_ON_LOCAL_STREAM: 'WEBRTC_ON_LOCAL_STREAM',
CAPTURE_STREAM_FAILED: 'CAPTURE_STREAM_FAILED' CAPTURE_STREAM_FAILED: 'CAPTURE_STREAM_FAILED'
@ -7285,7 +7285,7 @@ var ZLMRTCClient = (function (exports) {
debug: false, debug: false,
// if output debug log // if output debug log
zlmsdpUrl: '', zlmsdpUrl: '',
simulecast: false, simulcast: false,
useCamera: true, useCamera: true,
audioEnable: true, audioEnable: true,
videoEnable: true, videoEnable: true,
@ -7342,16 +7342,16 @@ var ZLMRTCClient = (function (exports) {
let ret = response.data; //JSON.parse(response.data); let ret = response.data; //JSON.parse(response.data);
if (ret.code != 0) { if (ret.code != 0) {
// mean failed for offer/anwser exchange // mean failed for offer/answer exchange
this.dispatch(Events$1.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED, ret); this.dispatch(Events$1.WEBRTC_OFFER_ANSWER_EXCHANGE_FAILED, ret);
return; return;
} }
let anwser = {}; let answer = {};
anwser.sdp = ret.sdp; answer.sdp = ret.sdp;
anwser.type = 'answer'; answer.type = 'answer';
log(this.TAG, 'answer:', ret.sdp); log(this.TAG, 'answer:', ret.sdp);
this.pc.setRemoteDescription(anwser).then(() => { this.pc.setRemoteDescription(answer).then(() => {
log(this.TAG, 'set remote sucess'); log(this.TAG, 'set remote sucess');
}).catch(e => { }).catch(e => {
error(this.TAG, e); error(this.TAG, e);
@ -7398,7 +7398,7 @@ var ZLMRTCClient = (function (exports) {
sendEncodings: [] sendEncodings: []
}; };
if (this.options.simulecast && stream.getVideoTracks().length > 0) { if (this.options.simulcast && stream.getVideoTracks().length > 0) {
VideoTransceiverInit.sendEncodings = [{ VideoTransceiverInit.sendEncodings = [{
rid: 'q', rid: 'q',
active: true, active: true,
@ -7449,16 +7449,16 @@ var ZLMRTCClient = (function (exports) {
let ret = response.data; //JSON.parse(response.data); let ret = response.data; //JSON.parse(response.data);
if (ret.code != 0) { if (ret.code != 0) {
// mean failed for offer/anwser exchange // mean failed for offer/answer exchange
this.dispatch(Events$1.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED, ret); this.dispatch(Events$1.WEBRTC_OFFER_ANSWER_EXCHANGE_FAILED, ret);
return; return;
} }
let anwser = {}; let answer = {};
anwser.sdp = ret.sdp; answer.sdp = ret.sdp;
anwser.type = 'answer'; answer.type = 'answer';
log(this.TAG, 'answer:', ret.sdp); log(this.TAG, 'answer:', ret.sdp);
this.pc.setRemoteDescription(anwser).then(() => { this.pc.setRemoteDescription(answer).then(() => {
log(this.TAG, 'set remote sucess'); log(this.TAG, 'set remote sucess');
}).catch(e => { }).catch(e => {
error(this.TAG, e); error(this.TAG, e);

File diff suppressed because one or more lines are too long

View File

@ -26,8 +26,8 @@
</p> </p>
<p> <p>
<label for="simulecast">simulecast:</label> <label for="simulcast">simulcast:</label>
<input type="checkbox" id='simulecast' checked="checked"> <input type="checkbox" id='simulcast' checked="checked">
</p> </p>
<p> <p>
<label for="useCamera">useCamera:</label> <label for="useCamera">useCamera:</label>
@ -46,14 +46,14 @@
</p> </p>
<p> <p>
<label for="methond">methond(play or push):</label> <label for="method">method(play or push):</label>
<input type="radio" name="methond" value="push" >push <input type="radio" name="method" value="push" >push
<input type="radio" name="methond" value="play" checked = true>play <input type="radio" name="method" value="play" checked = true>play
</p> </p>
<p> <p>
<label for="resilution">resolution:</label> <label for="resolution">resolution:</label>
<select id="resilution"> <select id="resolution">
</select> </select>
</p> </p>
@ -69,7 +69,7 @@
var recvOnly = true var recvOnly = true
var resArr = [] var resArr = []
document.getElementsByName("methond").forEach((el,idx)=>{ document.getElementsByName("method").forEach((el,idx)=>{
el.onclick=function(e){ el.onclick=function(e){
if(el.value == "play") if(el.value == "play")
{ {
@ -91,14 +91,14 @@
opt = document.createElement('option'); opt = document.createElement('option');
opt.text = r.label +"("+r.width+"x"+r.height+")"; opt.text = r.label +"("+r.width+"x"+r.height+")";
opt.value = r; opt.value = r;
document.getElementById("resilution").add(opt,null) document.getElementById("resolution").add(opt,null)
//console.log(opt.text.match(/\d+/g)) //console.log(opt.text.match(/\d+/g))
}) })
function start_play(){ function start_play(){
let elr = document.getElementById("resilution"); let elr = document.getElementById("resolution");
let res = elr.options[elr.selectedIndex].text.match(/\d+/g); let res = elr.options[elr.selectedIndex].text.match(/\d+/g);
let h = parseInt(res.pop()); let h = parseInt(res.pop());
let w = parseInt(res.pop()); let w = parseInt(res.pop());
@ -108,7 +108,7 @@
element: document.getElementById('video'),// video 标签 element: document.getElementById('video'),// video 标签
debug: true,// 是否打印日志 debug: true,// 是否打印日志
zlmsdpUrl:document.getElementById('streamUrl').value,//流地址 zlmsdpUrl:document.getElementById('streamUrl').value,//流地址
simulecast:false,//document.getElementById('simulecast').checked, simulcast:false,//document.getElementById('simulcast').checked,
useCamera:document.getElementById('useCamera').checked, useCamera:document.getElementById('useCamera').checked,
audioEnable:document.getElementById('audioEnable').checked, audioEnable:document.getElementById('audioEnable').checked,
videoEnable:document.getElementById('videoEnable').checked, videoEnable:document.getElementById('videoEnable').checked,
@ -127,9 +127,9 @@
console.log('播放成功',e.streams) console.log('播放成功',e.streams)
}); });
player.on(ZLMRTCClient.Events.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED,function(e) player.on(ZLMRTCClient.Events.WEBRTC_OFFER_ANSWER_EXCHANGE_FAILED,function(e)
{// offer anwser 交换失败 {// offer answer 交换失败
console.log('offer anwser 交换失败',e) console.log('offer answer 交换失败',e)
stop(); stop();
}); });
@ -139,7 +139,7 @@
document.getElementById('selfVideo').srcObject=s; document.getElementById('selfVideo').srcObject=s;
document.getElementById('selfVideo').muted = true; document.getElementById('selfVideo').muted = true;
//console.log('offer anwser 交换失败',e) //console.log('offer answer 交换失败',e)
}); });
player.on(ZLMRTCClient.Events.CAPTURE_STREAM_FAILED,function(s) player.on(ZLMRTCClient.Events.CAPTURE_STREAM_FAILED,function(s)
@ -152,7 +152,7 @@
function start() function start()
{ {
stop(); stop();
let elr = document.getElementById("resilution"); let elr = document.getElementById("resolution");
let res = elr.options[elr.selectedIndex].text.match(/\d+/g); let res = elr.options[elr.selectedIndex].text.match(/\d+/g);
let h = parseInt(res.pop()); let h = parseInt(res.pop());
let w = parseInt(res.pop()); let w = parseInt(res.pop());