@besovideo/webrtc-player 0.8.94 → 0.8.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/README.webrtc.md +21 -0
- package/dist/main.browser.js +5 -3
- package/dist/main.es.js +5 -3
- package/dist/types/plugins/ptz/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/README.webrtc.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
这个包封装了[平台接口](https://bvcsp.apifox.cn/)流媒体相关的操作。
|
|
2
|
+
包含 实时视频 对讲 会议的流媒体 操作
|
|
3
|
+
|
|
4
|
+
流媒体基于webrtc 和 bvrtc两种
|
|
5
|
+
|
|
6
|
+
### 先介绍Webrtc,介绍之后说下webrtc和bvrtc的区别:
|
|
7
|
+
|
|
8
|
+
[简介](https://developer.mozilla.org/zh-CN/docs/Web/API/WebRTC_API/Session_lifetime)
|
|
9
|
+
|
|
10
|
+
[Webrtc的信令事务流程](https://developer.mozilla.org/zh-CN/docs/Web/API/WebRTC_API/Signaling_and_video_calling#%E4%BF%A1%E4%BB%A4%E4%BA%8B%E5%8A%A1%E6%B5%81%E7%A8%8B)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
[平台接口打开设备音视频流webrtc](https://bvcsp.apifox.cn/api-171249025)接口用作信令交互,就是上图中交互[SDP](https://developer.mozilla.org/zh-CN/docs/Glossary/SDP)。
|
|
14
|
+
|
|
15
|
+
通过webrtc打开设备实时视频 本包封装的过程就是,
|
|
16
|
+
1、创建 const rtcPC = RTCPeerConnection
|
|
17
|
+
2、创建Offer const {type, sdp} = await [rtcPC.createOffer()](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createOffer)
|
|
18
|
+
3、设置本地SDP await [rtcPC.setLocalDescription](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/setLocalDescription)({type, sdp})
|
|
19
|
+
4、通过 [平台接口打开设备音视频流webrtc](https://bvcsp.apifox.cn/api-171249025) 发送SDP到服务器,收到远程SDP, 保存 const remoteSDP = await post('/bvcsp/v1/dialog/device/webrtc', {...});
|
|
20
|
+
5、设置rtcPC的远程SDP [rtcPC.setRemoteDescription()](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/setRemoteDescription)({type: 'anwser', sdp: remoteSDP})
|
|
21
|
+
|
package/dist/main.browser.js
CHANGED
|
@@ -117,7 +117,7 @@ var bvPlayerCore = (() => {
|
|
|
117
117
|
var define_processenv_default;
|
|
118
118
|
var init_define_processenv = __esm({
|
|
119
119
|
"<define:processenv>"() {
|
|
120
|
-
define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.
|
|
120
|
+
define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.95", PROJECT_NAMESPACE: "bvplayer" };
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
|
|
@@ -12594,8 +12594,9 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
12594
12594
|
this.vSpeed = 50;
|
|
12595
12595
|
this.iPresetPoint = 1;
|
|
12596
12596
|
this._buttons = [];
|
|
12597
|
+
this._toastInject = {};
|
|
12597
12598
|
this._speedSlider = new speedSlider_default(this.hSpeed);
|
|
12598
|
-
this.
|
|
12599
|
+
this._toastInject.toast = params.toast;
|
|
12599
12600
|
}
|
|
12600
12601
|
// 由外界设置设备参数 也可直接通过public字段单独设置
|
|
12601
12602
|
setPuParam(puOption, token) {
|
|
@@ -12607,6 +12608,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
12607
12608
|
if (!operate)
|
|
12608
12609
|
return;
|
|
12609
12610
|
const sendOperate = (stop) => __async(this, null, function* () {
|
|
12611
|
+
var _a;
|
|
12610
12612
|
logger_default.debug("sendOperate", operate, this.vSpeed, this.hSpeed, stop);
|
|
12611
12613
|
if (!this.puOption || !this.token)
|
|
12612
12614
|
return;
|
|
@@ -12624,7 +12626,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
12624
12626
|
);
|
|
12625
12627
|
} catch (e) {
|
|
12626
12628
|
const errCamera = e;
|
|
12627
|
-
this.
|
|
12629
|
+
(_a = this._toastInject.toast) == null ? void 0 : _a.error(errCamera.getErrorCodeDesc());
|
|
12628
12630
|
}
|
|
12629
12631
|
});
|
|
12630
12632
|
button.addEventListener("start", () => sendOperate(false));
|
package/dist/main.es.js
CHANGED
|
@@ -111,7 +111,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
111
111
|
var define_processenv_default;
|
|
112
112
|
var init_define_processenv = __esm({
|
|
113
113
|
"<define:processenv>"() {
|
|
114
|
-
define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.
|
|
114
|
+
define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.95", PROJECT_NAMESPACE: "bvplayer" };
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
|
|
@@ -12578,8 +12578,9 @@ var PtzPluginBase = class extends Plugin {
|
|
|
12578
12578
|
this.vSpeed = 50;
|
|
12579
12579
|
this.iPresetPoint = 1;
|
|
12580
12580
|
this._buttons = [];
|
|
12581
|
+
this._toastInject = {};
|
|
12581
12582
|
this._speedSlider = new speedSlider_default(this.hSpeed);
|
|
12582
|
-
this.
|
|
12583
|
+
this._toastInject.toast = params.toast;
|
|
12583
12584
|
}
|
|
12584
12585
|
// 由外界设置设备参数 也可直接通过public字段单独设置
|
|
12585
12586
|
setPuParam(puOption, token) {
|
|
@@ -12591,6 +12592,7 @@ var PtzPluginBase = class extends Plugin {
|
|
|
12591
12592
|
if (!operate)
|
|
12592
12593
|
return;
|
|
12593
12594
|
const sendOperate = (stop) => __async(this, null, function* () {
|
|
12595
|
+
var _a;
|
|
12594
12596
|
logger_default.debug("sendOperate", operate, this.vSpeed, this.hSpeed, stop);
|
|
12595
12597
|
if (!this.puOption || !this.token)
|
|
12596
12598
|
return;
|
|
@@ -12608,7 +12610,7 @@ var PtzPluginBase = class extends Plugin {
|
|
|
12608
12610
|
);
|
|
12609
12611
|
} catch (e) {
|
|
12610
12612
|
const errCamera = e;
|
|
12611
|
-
this.
|
|
12613
|
+
(_a = this._toastInject.toast) == null ? void 0 : _a.error(errCamera.getErrorCodeDesc());
|
|
12612
12614
|
}
|
|
12613
12615
|
});
|
|
12614
12616
|
button.addEventListener("start", () => sendOperate(false));
|