@besovideo/webrtc-player 0.9.7 → 0.9.81
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/dist/main.browser.js +63 -8
- package/dist/main.es.js +63 -8
- package/dist/types/templates/icons.d.ts +1 -0
- package/package.json +1 -1
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.9.
|
|
120
|
+
define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.9.81", PROJECT_NAMESPACE: "bvplayer" };
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
|
|
@@ -14841,9 +14841,10 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
14841
14841
|
const clsName = core_default.style.cls(["icon", className]);
|
|
14842
14842
|
return /* @__PURE__ */ jsx_default.h("span", { className: clsName, style: style2, withNamespace: true }, children);
|
|
14843
14843
|
};
|
|
14844
|
+
var svgForbidden = /* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16px", height: "16px", viewBox: "0 0 72 72" }, /* @__PURE__ */ jsx_default.h("circle", { cx: "36", cy: "36", r: "26", fill: "#fff" }), /* @__PURE__ */ jsx_default.h("path", { fill: "#ea5a47", d: "M36 7C19.98 7 7 19.98 7 36s12.98 29 29 29s29-12.98 29-29S52.02 7 36 7M10.79 36.27c0-5.075 3.417-12.69 6.202-16.49l35.2 35.27c-3.805 2.784-10.93 5.904-16.01 5.904c-12.7 0-25.39-11.98-25.39-24.68zm44.87 15.18L20.6 16.32c3.805-2.784 10.77-5.441 15.84-5.441c12.7 0 24.68 12.25 24.68 24.95c0 5.075-2.686 11.81-5.47 15.62z" }), /* @__PURE__ */ jsx_default.h("g", { fill: "none", stroke: "#000", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, /* @__PURE__ */ jsx_default.h("circle", { cx: "36", cy: "36", r: "30" }), /* @__PURE__ */ jsx_default.h("path", { d: "M55.66 51.44A24.99 24.99 0 0 0 20.6 16.31zM16.99 19.77a24.99 24.99 0 0 0 35.2 35.27z" })));
|
|
14844
14845
|
var Cog = ({ filled }) => /* @__PURE__ */ jsx_default.h(Icon, null, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCogFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCog, null));
|
|
14845
14846
|
var Camera = ({ filled }) => /* @__PURE__ */ jsx_default.h(Icon, null, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCameraFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCamera, null));
|
|
14846
|
-
var VideoCamera = ({ filled }) => /* @__PURE__ */ jsx_default.h(Icon,
|
|
14847
|
+
var VideoCamera = ({ filled, forbidden }) => /* @__PURE__ */ jsx_default.h(Icon, { style: "position: relative" }, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreVideoCameraFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreVideoCamera, null), " ", forbidden ? /* @__PURE__ */ jsx_default.h("span", { style: "position: absolute;left: 5px; top: -2px" }, svgForbidden) : /* @__PURE__ */ jsx_default.h(jsx_default.Fragment, null));
|
|
14847
14848
|
var Info = ({ filled }) => {
|
|
14848
14849
|
return /* @__PURE__ */ jsx_default.h(Icon, null, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreInformationCircleFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreInformationCircle, null));
|
|
14849
14850
|
};
|
|
@@ -15392,10 +15393,13 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
15392
15393
|
},
|
|
15393
15394
|
record: () => {
|
|
15394
15395
|
const RecordButton = new button_default(
|
|
15395
|
-
/* @__PURE__ */ jsx_default.h(icons_default.VideoCamera,
|
|
15396
|
+
/* @__PURE__ */ jsx_default.h(icons_default.VideoCamera, { forbidden: !HTMLMediaElement.prototype.captureStream }),
|
|
15396
15397
|
"record"
|
|
15397
15398
|
);
|
|
15398
15399
|
const recordStart = () => {
|
|
15400
|
+
if (!HTMLMediaElement.prototype.captureStream) {
|
|
15401
|
+
return;
|
|
15402
|
+
}
|
|
15399
15403
|
this.dispatch("recordStart");
|
|
15400
15404
|
RecordButton.Children = /* @__PURE__ */ jsx_default.h(icons_default.Stop, null);
|
|
15401
15405
|
RecordButton.color = "#ed3838";
|
|
@@ -16029,8 +16033,31 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
16029
16033
|
} else if (!(`requestFullscreen` in DOC_EL)) {
|
|
16030
16034
|
console.assert(false, `\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301Fullscreen API !`);
|
|
16031
16035
|
}
|
|
16032
|
-
function
|
|
16033
|
-
return el
|
|
16036
|
+
function beFullCapIOSOnIphone() {
|
|
16037
|
+
return __async(this, arguments, function* (el = DOC_EL) {
|
|
16038
|
+
const videoEles = el.getElementsByTagName("video");
|
|
16039
|
+
if (videoEles.length) {
|
|
16040
|
+
const fullscreen2 = videoEles[0];
|
|
16041
|
+
const iIntervalToken = setInterval(() => {
|
|
16042
|
+
if (!fullscreen2.webkitDisplayingFullscreen) {
|
|
16043
|
+
clearInterval(iIntervalToken);
|
|
16044
|
+
setTimeout(() => {
|
|
16045
|
+
fullscreen2.play();
|
|
16046
|
+
}, 500);
|
|
16047
|
+
}
|
|
16048
|
+
}, 1e3);
|
|
16049
|
+
return fullscreen2["webkitEnterFullscreen"]();
|
|
16050
|
+
}
|
|
16051
|
+
});
|
|
16052
|
+
}
|
|
16053
|
+
function beFull() {
|
|
16054
|
+
return __async(this, arguments, function* (el = DOC_EL, options) {
|
|
16055
|
+
if (!el[RFC_METHOD_NAME]) {
|
|
16056
|
+
return yield beFullCapIOSOnIphone(el);
|
|
16057
|
+
} else {
|
|
16058
|
+
return el[RFC_METHOD_NAME](options);
|
|
16059
|
+
}
|
|
16060
|
+
});
|
|
16034
16061
|
}
|
|
16035
16062
|
function exitFull() {
|
|
16036
16063
|
return document[EFS_METHOD_NAME]();
|
|
@@ -20117,6 +20144,9 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
20117
20144
|
}
|
|
20118
20145
|
recordStart() {
|
|
20119
20146
|
var _a, _b;
|
|
20147
|
+
if (!HTMLMediaElement.prototype.captureStream) {
|
|
20148
|
+
return;
|
|
20149
|
+
}
|
|
20120
20150
|
if (!this._recordState.BRecording()) {
|
|
20121
20151
|
if ((_a = this._panel) == null ? void 0 : _a.controller.RecordButton) {
|
|
20122
20152
|
(_b = this._panel) == null ? void 0 : _b.controller.RecordButton.dispatch("click");
|
|
@@ -20129,6 +20159,9 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
20129
20159
|
}
|
|
20130
20160
|
recordStop() {
|
|
20131
20161
|
var _a, _b;
|
|
20162
|
+
if (!HTMLMediaElement.prototype.captureStream) {
|
|
20163
|
+
return;
|
|
20164
|
+
}
|
|
20132
20165
|
if (this._recordState.BRecording()) {
|
|
20133
20166
|
if ((_a = this._panel) == null ? void 0 : _a.controller.RecordButton) {
|
|
20134
20167
|
(_b = this._panel) == null ? void 0 : _b.controller.RecordButton.dispatch("click");
|
|
@@ -21210,6 +21243,8 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
21210
21243
|
}
|
|
21211
21244
|
};
|
|
21212
21245
|
function createWorker() {
|
|
21246
|
+
const WindowInject = `var window = {location: {host: '${window.location.host}',protocol: '${window.location.protocol}',}};`;
|
|
21247
|
+
WORKER_STRING = WindowInject + WORKER_STRING;
|
|
21213
21248
|
const workerBolb = new Blob([WORKER_STRING], {
|
|
21214
21249
|
type: "application/javascript"
|
|
21215
21250
|
});
|
|
@@ -22506,6 +22541,13 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
|
|
|
22506
22541
|
getRemoteSdpParam,
|
|
22507
22542
|
apiPrefix
|
|
22508
22543
|
);
|
|
22544
|
+
let localStreamRelease = void 0;
|
|
22545
|
+
const releaseLocalStream = () => {
|
|
22546
|
+
if (localStreamRelease) {
|
|
22547
|
+
localStreamRelease();
|
|
22548
|
+
localStreamRelease = void 0;
|
|
22549
|
+
}
|
|
22550
|
+
};
|
|
22509
22551
|
const { instance: bvWebrtcComponentInstance, element } = bvWebrtc_default({
|
|
22510
22552
|
container,
|
|
22511
22553
|
sdpFetcher,
|
|
@@ -22516,13 +22558,26 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
|
|
|
22516
22558
|
muted: false,
|
|
22517
22559
|
autoPlay: true,
|
|
22518
22560
|
onConnected,
|
|
22519
|
-
onClose
|
|
22520
|
-
|
|
22521
|
-
|
|
22561
|
+
onClose: () => {
|
|
22562
|
+
releaseLocalStream();
|
|
22563
|
+
onClose == null ? void 0 : onClose();
|
|
22564
|
+
},
|
|
22565
|
+
onDestroy: () => {
|
|
22566
|
+
releaseLocalStream();
|
|
22567
|
+
onDestroy2 == null ? void 0 : onDestroy2();
|
|
22568
|
+
},
|
|
22569
|
+
onDisConnected: () => {
|
|
22570
|
+
releaseLocalStream();
|
|
22571
|
+
onDisConnected == null ? void 0 : onDisConnected();
|
|
22572
|
+
},
|
|
22522
22573
|
onPcEventAdded: (pc) => __async(void 0, null, function* () {
|
|
22523
22574
|
try {
|
|
22524
22575
|
const localStream = yield getUserMedia();
|
|
22525
22576
|
localStream.getTracks().forEach((track) => pc.addTrack(track, localStream));
|
|
22577
|
+
releaseLocalStream();
|
|
22578
|
+
localStreamRelease = () => {
|
|
22579
|
+
localStream.getTracks().forEach((t2) => t2.stop());
|
|
22580
|
+
};
|
|
22526
22581
|
} catch (e) {
|
|
22527
22582
|
onGetUserMediaFailed && onGetUserMediaFailed();
|
|
22528
22583
|
}
|
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.9.
|
|
114
|
+
define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.9.81", PROJECT_NAMESPACE: "bvplayer" };
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
|
|
@@ -14825,9 +14825,10 @@ var Icon = ({ children, className, style: style2 }) => {
|
|
|
14825
14825
|
const clsName = core_default.style.cls(["icon", className]);
|
|
14826
14826
|
return /* @__PURE__ */ jsx_default.h("span", { className: clsName, style: style2, withNamespace: true }, children);
|
|
14827
14827
|
};
|
|
14828
|
+
var svgForbidden = /* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16px", height: "16px", viewBox: "0 0 72 72" }, /* @__PURE__ */ jsx_default.h("circle", { cx: "36", cy: "36", r: "26", fill: "#fff" }), /* @__PURE__ */ jsx_default.h("path", { fill: "#ea5a47", d: "M36 7C19.98 7 7 19.98 7 36s12.98 29 29 29s29-12.98 29-29S52.02 7 36 7M10.79 36.27c0-5.075 3.417-12.69 6.202-16.49l35.2 35.27c-3.805 2.784-10.93 5.904-16.01 5.904c-12.7 0-25.39-11.98-25.39-24.68zm44.87 15.18L20.6 16.32c3.805-2.784 10.77-5.441 15.84-5.441c12.7 0 24.68 12.25 24.68 24.95c0 5.075-2.686 11.81-5.47 15.62z" }), /* @__PURE__ */ jsx_default.h("g", { fill: "none", stroke: "#000", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, /* @__PURE__ */ jsx_default.h("circle", { cx: "36", cy: "36", r: "30" }), /* @__PURE__ */ jsx_default.h("path", { d: "M55.66 51.44A24.99 24.99 0 0 0 20.6 16.31zM16.99 19.77a24.99 24.99 0 0 0 35.2 35.27z" })));
|
|
14828
14829
|
var Cog = ({ filled }) => /* @__PURE__ */ jsx_default.h(Icon, null, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCogFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCog, null));
|
|
14829
14830
|
var Camera = ({ filled }) => /* @__PURE__ */ jsx_default.h(Icon, null, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCameraFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreCamera, null));
|
|
14830
|
-
var VideoCamera = ({ filled }) => /* @__PURE__ */ jsx_default.h(Icon,
|
|
14831
|
+
var VideoCamera = ({ filled, forbidden }) => /* @__PURE__ */ jsx_default.h(Icon, { style: "position: relative" }, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreVideoCameraFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreVideoCamera, null), " ", forbidden ? /* @__PURE__ */ jsx_default.h("span", { style: "position: absolute;left: 5px; top: -2px" }, svgForbidden) : /* @__PURE__ */ jsx_default.h(jsx_default.Fragment, null));
|
|
14831
14832
|
var Info = ({ filled }) => {
|
|
14832
14833
|
return /* @__PURE__ */ jsx_default.h(Icon, null, filled ? /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreInformationCircleFill, null) : /* @__PURE__ */ jsx_default.h(SvgElementbvPlayerCoreInformationCircle, null));
|
|
14833
14834
|
};
|
|
@@ -15376,10 +15377,13 @@ var ControllerPluginBase = class extends Plugin {
|
|
|
15376
15377
|
},
|
|
15377
15378
|
record: () => {
|
|
15378
15379
|
const RecordButton = new button_default(
|
|
15379
|
-
/* @__PURE__ */ jsx_default.h(icons_default.VideoCamera,
|
|
15380
|
+
/* @__PURE__ */ jsx_default.h(icons_default.VideoCamera, { forbidden: !HTMLMediaElement.prototype.captureStream }),
|
|
15380
15381
|
"record"
|
|
15381
15382
|
);
|
|
15382
15383
|
const recordStart = () => {
|
|
15384
|
+
if (!HTMLMediaElement.prototype.captureStream) {
|
|
15385
|
+
return;
|
|
15386
|
+
}
|
|
15383
15387
|
this.dispatch("recordStart");
|
|
15384
15388
|
RecordButton.Children = /* @__PURE__ */ jsx_default.h(icons_default.Stop, null);
|
|
15385
15389
|
RecordButton.color = "#ed3838";
|
|
@@ -16013,8 +16017,31 @@ if (`webkitRequestFullScreen` in DOC_EL) {
|
|
|
16013
16017
|
} else if (!(`requestFullscreen` in DOC_EL)) {
|
|
16014
16018
|
console.assert(false, `\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301Fullscreen API !`);
|
|
16015
16019
|
}
|
|
16016
|
-
function
|
|
16017
|
-
return el
|
|
16020
|
+
function beFullCapIOSOnIphone() {
|
|
16021
|
+
return __async(this, arguments, function* (el = DOC_EL) {
|
|
16022
|
+
const videoEles = el.getElementsByTagName("video");
|
|
16023
|
+
if (videoEles.length) {
|
|
16024
|
+
const fullscreen2 = videoEles[0];
|
|
16025
|
+
const iIntervalToken = setInterval(() => {
|
|
16026
|
+
if (!fullscreen2.webkitDisplayingFullscreen) {
|
|
16027
|
+
clearInterval(iIntervalToken);
|
|
16028
|
+
setTimeout(() => {
|
|
16029
|
+
fullscreen2.play();
|
|
16030
|
+
}, 500);
|
|
16031
|
+
}
|
|
16032
|
+
}, 1e3);
|
|
16033
|
+
return fullscreen2["webkitEnterFullscreen"]();
|
|
16034
|
+
}
|
|
16035
|
+
});
|
|
16036
|
+
}
|
|
16037
|
+
function beFull() {
|
|
16038
|
+
return __async(this, arguments, function* (el = DOC_EL, options) {
|
|
16039
|
+
if (!el[RFC_METHOD_NAME]) {
|
|
16040
|
+
return yield beFullCapIOSOnIphone(el);
|
|
16041
|
+
} else {
|
|
16042
|
+
return el[RFC_METHOD_NAME](options);
|
|
16043
|
+
}
|
|
16044
|
+
});
|
|
16018
16045
|
}
|
|
16019
16046
|
function exitFull() {
|
|
16020
16047
|
return document[EFS_METHOD_NAME]();
|
|
@@ -20101,6 +20128,9 @@ var PlayerPlugin = class extends Plugin {
|
|
|
20101
20128
|
}
|
|
20102
20129
|
recordStart() {
|
|
20103
20130
|
var _a, _b;
|
|
20131
|
+
if (!HTMLMediaElement.prototype.captureStream) {
|
|
20132
|
+
return;
|
|
20133
|
+
}
|
|
20104
20134
|
if (!this._recordState.BRecording()) {
|
|
20105
20135
|
if ((_a = this._panel) == null ? void 0 : _a.controller.RecordButton) {
|
|
20106
20136
|
(_b = this._panel) == null ? void 0 : _b.controller.RecordButton.dispatch("click");
|
|
@@ -20113,6 +20143,9 @@ var PlayerPlugin = class extends Plugin {
|
|
|
20113
20143
|
}
|
|
20114
20144
|
recordStop() {
|
|
20115
20145
|
var _a, _b;
|
|
20146
|
+
if (!HTMLMediaElement.prototype.captureStream) {
|
|
20147
|
+
return;
|
|
20148
|
+
}
|
|
20116
20149
|
if (this._recordState.BRecording()) {
|
|
20117
20150
|
if ((_a = this._panel) == null ? void 0 : _a.controller.RecordButton) {
|
|
20118
20151
|
(_b = this._panel) == null ? void 0 : _b.controller.RecordButton.dispatch("click");
|
|
@@ -21194,6 +21227,8 @@ var BVMedia = class {
|
|
|
21194
21227
|
}
|
|
21195
21228
|
};
|
|
21196
21229
|
function createWorker() {
|
|
21230
|
+
const WindowInject = `var window = {location: {host: '${window.location.host}',protocol: '${window.location.protocol}',}};`;
|
|
21231
|
+
WORKER_STRING = WindowInject + WORKER_STRING;
|
|
21197
21232
|
const workerBolb = new Blob([WORKER_STRING], {
|
|
21198
21233
|
type: "application/javascript"
|
|
21199
21234
|
});
|
|
@@ -22490,6 +22525,13 @@ var AudioPlayer = (props) => {
|
|
|
22490
22525
|
getRemoteSdpParam,
|
|
22491
22526
|
apiPrefix
|
|
22492
22527
|
);
|
|
22528
|
+
let localStreamRelease = void 0;
|
|
22529
|
+
const releaseLocalStream = () => {
|
|
22530
|
+
if (localStreamRelease) {
|
|
22531
|
+
localStreamRelease();
|
|
22532
|
+
localStreamRelease = void 0;
|
|
22533
|
+
}
|
|
22534
|
+
};
|
|
22493
22535
|
const { instance: bvWebrtcComponentInstance, element } = bvWebrtc_default({
|
|
22494
22536
|
container,
|
|
22495
22537
|
sdpFetcher,
|
|
@@ -22500,13 +22542,26 @@ var AudioPlayer = (props) => {
|
|
|
22500
22542
|
muted: false,
|
|
22501
22543
|
autoPlay: true,
|
|
22502
22544
|
onConnected,
|
|
22503
|
-
onClose
|
|
22504
|
-
|
|
22505
|
-
|
|
22545
|
+
onClose: () => {
|
|
22546
|
+
releaseLocalStream();
|
|
22547
|
+
onClose == null ? void 0 : onClose();
|
|
22548
|
+
},
|
|
22549
|
+
onDestroy: () => {
|
|
22550
|
+
releaseLocalStream();
|
|
22551
|
+
onDestroy2 == null ? void 0 : onDestroy2();
|
|
22552
|
+
},
|
|
22553
|
+
onDisConnected: () => {
|
|
22554
|
+
releaseLocalStream();
|
|
22555
|
+
onDisConnected == null ? void 0 : onDisConnected();
|
|
22556
|
+
},
|
|
22506
22557
|
onPcEventAdded: (pc) => __async(void 0, null, function* () {
|
|
22507
22558
|
try {
|
|
22508
22559
|
const localStream = yield getUserMedia();
|
|
22509
22560
|
localStream.getTracks().forEach((track) => pc.addTrack(track, localStream));
|
|
22561
|
+
releaseLocalStream();
|
|
22562
|
+
localStreamRelease = () => {
|
|
22563
|
+
localStream.getTracks().forEach((t2) => t2.stop());
|
|
22564
|
+
};
|
|
22510
22565
|
} catch (e) {
|
|
22511
22566
|
onGetUserMediaFailed && onGetUserMediaFailed();
|
|
22512
22567
|
}
|