From d353fdce7cb957aa0f5d9d51d0ad4205c96e156c Mon Sep 17 00:00:00 2001 From: ‘liusuyi’ <1951119284@qq.com> Date: 星期六, 21 十月 2023 11:57:12 +0800 Subject: [PATCH] 1、流媒体升级1.2.0,修改部分forest接口 2、登录设备判断编码自动配置转码 3、增加sdk聚焦模式切换 4、增加sdk视场角获取并定时上传 --- ard-work/src/main/resources/templates/preview.html | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ard-work/src/main/resources/templates/preview.html b/ard-work/src/main/resources/templates/preview.html index a115bf1..f3ec144 100644 --- a/ard-work/src/main/resources/templates/preview.html +++ b/ard-work/src/main/resources/templates/preview.html @@ -107,6 +107,8 @@ </div> <script> + console.log(RTCRtpReceiver.getCapabilities('video').codecs) + console.log(RTCRtpReceiver.getCapabilities('audio').codecs) //whep鎿嶄綔鏂规硶 const linkToIceServers = (links) => ( (links !== null) ? links.split(', ').map((link) => { @@ -174,9 +176,9 @@ } class WHEPClient { - constructor(wurl, videoId) { + constructor(whepUrl, videoId) { this.video = videoId; - this.url = new URL('whep', wurl); + this.wurl = new URL('whep', whepUrl); this.pc = null; this.restartTimeout = null; this.eTag = ''; @@ -186,8 +188,11 @@ start() { console.log("requesting ICE servers"); - fetch(this.url, { + fetch(this.wurl, { method: 'OPTIONS', + headers: { + 'Referer': this.wurl, + }, }) .then((res) => this.onIceServers(res)) .catch((err) => { @@ -223,10 +228,11 @@ console.log("sending offer"); - fetch(this.url, { + fetch(this.wurl, { method: 'POST', headers: { 'Content-Type': 'application/sdp', + 'Referer': this.wurl, }, body: offer.sdp, }) @@ -234,7 +240,8 @@ if (res.status !== 201) { throw new Error('bad status code'); } - this.eTag = res.headers.get('E-Tag'); + // this.eTag = res.headers.get('ETag'); + this.eTag = res.headers.get("ETag") || res.headers.get('E-Tag'); return res.text(); }) .then((sdp) => this.onRemoteAnswer(new RTCSessionDescription({ @@ -288,12 +295,14 @@ } sendLocalCandidates(candidates) { - fetch(this.url, { + fetch(this.wurl, { method: 'PATCH', headers: { 'Content-Type': 'application/trickle-ice-sdpfrag', 'If-Match': this.eTag, + 'Referer': this.wurl, }, + body: generateSdpFragment(this.offerData, candidates), }) .then((res) => { -- Gitblit v1.9.3