@besovideo/webrtc-player 0.8.96 → 0.8.97
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 +18 -4
- package/dist/main.browser.css +16 -0
- package/dist/main.browser.js +31 -13
- package/dist/main.es.css +16 -0
- package/dist/main.es.js +31 -13
- package/dist/types/components/subComponent/playState.d.ts +3 -0
- package/dist/types/plugins/player/event.d.ts +4 -1
- package/dist/types/plugins/video.d.ts +2 -1
- package/dist/types/utils/media.d.ts +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ const { instance } = PuPlayer({
|
|
|
62
62
|
// (可选) 指定video如何适应容器 (fill: 填充容器 ; contain :保持视频比例适应容器)
|
|
63
63
|
videoFit: "fill",
|
|
64
64
|
// (可选) 指定请求url路径前缀 可使用protocol+host 如:http://192.168.88.11:9780
|
|
65
|
-
|
|
65
|
+
apiPrefix: "/test_api/prefix",
|
|
66
66
|
|
|
67
67
|
// (可选) 用于测试播放视频 (存在时优先使用url播放,为浏览器直接播放)
|
|
68
68
|
// testUrl: "https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-576p.mp4",
|
|
@@ -254,9 +254,23 @@ instance.playerStatus : {
|
|
|
254
254
|
exec(): void;
|
|
255
255
|
// 添加事件监听,获取截图结果,
|
|
256
256
|
// cancelAutoDownload 函数,调用会取消掉下载图片
|
|
257
|
-
addEventListener(handle: ((
|
|
257
|
+
addEventListener(handle: ((
|
|
258
|
+
status: {
|
|
259
|
+
img?: Blob,
|
|
260
|
+
fileName?: string,
|
|
261
|
+
cancelAutoDownload?: ()=>{
|
|
262
|
+
download(fileName?: string): void //下载图片
|
|
263
|
+
}
|
|
264
|
+
})) => void)):void;
|
|
258
265
|
// 移除事件监听
|
|
259
|
-
removeEventListener(handle: ((
|
|
266
|
+
removeEventListener(handle: ((
|
|
267
|
+
status: {
|
|
268
|
+
img?: Blob,
|
|
269
|
+
fileName?: string,
|
|
270
|
+
cancelAutoDownload?: ()=>{
|
|
271
|
+
download(fileName?: string): void //下载图片
|
|
272
|
+
}
|
|
273
|
+
})) => void)):void;
|
|
260
274
|
},
|
|
261
275
|
informationGet: () => Promise<{
|
|
262
276
|
//音频统计信息
|
|
@@ -361,7 +375,7 @@ const { instance } = Intercom({
|
|
|
361
375
|
//(可选) 无法获取用户麦克风时
|
|
362
376
|
onGetUserMediaFailed: () => {},
|
|
363
377
|
// (可选) 指定请求url的前缀 方便代理请求
|
|
364
|
-
|
|
378
|
+
apiPrefix: "/test_api/prefix",
|
|
365
379
|
});
|
|
366
380
|
|
|
367
381
|
// open 异步 先关闭再开始建立连接 (可选参数: protocol = type 选择协议(type = "auto" | "webrtc" | "ws-bvrtc") 不填默认为auto)
|
package/dist/main.browser.css
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
|
|
1
3
|
/* sass-plugin-1:G:\develop\bvweb-player\node_modules\.pnpm\tippy.js@6.3.7\node_modules\tippy.js\dist\tippy.css */
|
|
2
4
|
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
3
5
|
opacity: 0;
|
|
@@ -455,6 +457,20 @@
|
|
|
455
457
|
width: 100px;
|
|
456
458
|
border-radius: 5px;
|
|
457
459
|
}
|
|
460
|
+
.bvplayer-recordState .blinking-element {
|
|
461
|
+
animation: blink 2s infinite;
|
|
462
|
+
}
|
|
463
|
+
@keyframes blink {
|
|
464
|
+
0% {
|
|
465
|
+
opacity: 1;
|
|
466
|
+
}
|
|
467
|
+
50% {
|
|
468
|
+
opacity: 0.1;
|
|
469
|
+
}
|
|
470
|
+
100% {
|
|
471
|
+
opacity: 1;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
458
474
|
.bvplayer-video {
|
|
459
475
|
display: block;
|
|
460
476
|
box-sizing: border-box;
|
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.97", PROJECT_NAMESPACE: "bvplayer" };
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
|
|
@@ -7252,8 +7252,13 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
7252
7252
|
const blob = yield canvasToBlob(canvas);
|
|
7253
7253
|
return {
|
|
7254
7254
|
blob,
|
|
7255
|
-
|
|
7256
|
-
|
|
7255
|
+
fileName,
|
|
7256
|
+
download(fileNameCaller) {
|
|
7257
|
+
file_default.downLoadBlob(
|
|
7258
|
+
blob,
|
|
7259
|
+
fileNameCaller ? fileNameCaller : fileName,
|
|
7260
|
+
"png"
|
|
7261
|
+
);
|
|
7257
7262
|
}
|
|
7258
7263
|
};
|
|
7259
7264
|
} catch (e) {
|
|
@@ -7286,11 +7291,7 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
7286
7291
|
bDownload = false;
|
|
7287
7292
|
return downloadRecordGetter();
|
|
7288
7293
|
};
|
|
7289
|
-
holder(
|
|
7290
|
-
blob,
|
|
7291
|
-
metaInfo,
|
|
7292
|
-
cancelAutoDownload
|
|
7293
|
-
);
|
|
7294
|
+
holder(blob, metaInfo, cancelAutoDownload);
|
|
7294
7295
|
return bDownload;
|
|
7295
7296
|
}
|
|
7296
7297
|
return true;
|
|
@@ -12864,10 +12865,20 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
12864
12865
|
}
|
|
12865
12866
|
init(_container) {
|
|
12866
12867
|
const el = this.el;
|
|
12867
|
-
const svgRecord = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256" style="vertical-align: sub;" ><rect width="256" height="256" fill="none"/><circle cx="127" cy="129" r="81" fill="#dd2c2c" fill-rule="evenodd"/></svg>`;
|
|
12868
|
+
const svgRecord = `<svg class='blinking-element' xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256" style="vertical-align: sub;" ><rect width="256" height="256" fill="none"/><circle cx="127" cy="129" r="81" fill="#dd2c2c" fill-rule="evenodd"/></svg>`;
|
|
12868
12869
|
el.style.display = "none";
|
|
12869
|
-
const spinEl = core_default.dom.create("
|
|
12870
|
-
spinEl.innerHTML = `${svgRecord}
|
|
12870
|
+
const spinEl = core_default.dom.create("div");
|
|
12871
|
+
spinEl.innerHTML = `${svgRecord}`;
|
|
12872
|
+
spinEl.style.color = "black";
|
|
12873
|
+
spinEl.style.backgroundColor = "white";
|
|
12874
|
+
spinEl.style.margin = "5px 5px";
|
|
12875
|
+
spinEl.style.padding = "2px 5px 2px 1px";
|
|
12876
|
+
spinEl.style.top = "5px";
|
|
12877
|
+
spinEl.style.left = "5px";
|
|
12878
|
+
spinEl.style.borderRadius = "4px";
|
|
12879
|
+
const sliceSpan = document.createElement("span");
|
|
12880
|
+
spinEl.appendChild(sliceSpan);
|
|
12881
|
+
sliceSpan.innerHTML = "00:00:00";
|
|
12871
12882
|
core_default.dom.append(el, spinEl);
|
|
12872
12883
|
this.spanEle = spinEl;
|
|
12873
12884
|
let recordStart = 0;
|
|
@@ -12882,7 +12893,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
12882
12893
|
const mins = formatTime(lastTime, 60);
|
|
12883
12894
|
const seconds = Math.floor(lastTime % 60);
|
|
12884
12895
|
const fomatSeconds = seconds > 9 ? seconds : "0" + seconds;
|
|
12885
|
-
|
|
12896
|
+
sliceSpan.innerHTML = `${hour + mins + fomatSeconds}`;
|
|
12886
12897
|
}
|
|
12887
12898
|
this.addEventListener("RecordStart", () => {
|
|
12888
12899
|
if (this.el) {
|
|
@@ -12897,7 +12908,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
12897
12908
|
});
|
|
12898
12909
|
this.addEventListener("RecordEnd", () => {
|
|
12899
12910
|
if (this.el) {
|
|
12900
|
-
|
|
12911
|
+
sliceSpan.innerHTML = "00:00:00";
|
|
12901
12912
|
this.el.style.display = "none";
|
|
12902
12913
|
}
|
|
12903
12914
|
if (this.intervalToken) {
|
|
@@ -13162,8 +13173,14 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
13162
13173
|
let bDownload = true;
|
|
13163
13174
|
this.dispatch("screenshot", screenshotResult && screenshotResult.blob ? {
|
|
13164
13175
|
img: screenshotResult.blob,
|
|
13176
|
+
fileName: screenshotResult.fileName,
|
|
13165
13177
|
cancelAutoDownload() {
|
|
13166
13178
|
bDownload = false;
|
|
13179
|
+
return {
|
|
13180
|
+
download(fileName) {
|
|
13181
|
+
screenshotResult == null ? void 0 : screenshotResult.download(fileName);
|
|
13182
|
+
}
|
|
13183
|
+
};
|
|
13167
13184
|
}
|
|
13168
13185
|
} : void 0);
|
|
13169
13186
|
if (bDownload && (screenshotResult == null ? void 0 : screenshotResult.download)) {
|
|
@@ -16392,6 +16409,7 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
|
|
|
16392
16409
|
return player.addEventListener("screenshot", (data) => {
|
|
16393
16410
|
handleUtils.dispatch({
|
|
16394
16411
|
img: data == null ? void 0 : data.img,
|
|
16412
|
+
fileName: data == null ? void 0 : data.fileName,
|
|
16395
16413
|
cancelAutoDownload: data == null ? void 0 : data.cancelAutoDownload
|
|
16396
16414
|
});
|
|
16397
16415
|
});
|
package/dist/main.es.css
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
|
|
1
3
|
/* sass-plugin-0:G:\develop\bvweb-player\node_modules\.pnpm\tippy.js@6.3.7\node_modules\tippy.js\dist\tippy.css */
|
|
2
4
|
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
3
5
|
opacity: 0;
|
|
@@ -455,6 +457,20 @@
|
|
|
455
457
|
width: 100px;
|
|
456
458
|
border-radius: 5px;
|
|
457
459
|
}
|
|
460
|
+
.bvplayer-recordState .blinking-element {
|
|
461
|
+
animation: blink 2s infinite;
|
|
462
|
+
}
|
|
463
|
+
@keyframes blink {
|
|
464
|
+
0% {
|
|
465
|
+
opacity: 1;
|
|
466
|
+
}
|
|
467
|
+
50% {
|
|
468
|
+
opacity: 0.1;
|
|
469
|
+
}
|
|
470
|
+
100% {
|
|
471
|
+
opacity: 1;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
458
474
|
.bvplayer-video {
|
|
459
475
|
display: block;
|
|
460
476
|
box-sizing: border-box;
|
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.97", PROJECT_NAMESPACE: "bvplayer" };
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
|
|
@@ -7236,8 +7236,13 @@ var screenshotByCanvas = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (
|
|
|
7236
7236
|
const blob = yield canvasToBlob(canvas);
|
|
7237
7237
|
return {
|
|
7238
7238
|
blob,
|
|
7239
|
-
|
|
7240
|
-
|
|
7239
|
+
fileName,
|
|
7240
|
+
download(fileNameCaller) {
|
|
7241
|
+
file_default.downLoadBlob(
|
|
7242
|
+
blob,
|
|
7243
|
+
fileNameCaller ? fileNameCaller : fileName,
|
|
7244
|
+
"png"
|
|
7245
|
+
);
|
|
7241
7246
|
}
|
|
7242
7247
|
};
|
|
7243
7248
|
} catch (e) {
|
|
@@ -7270,11 +7275,7 @@ var record = (element, stream, fileName = `record_${Date.now()}`) => {
|
|
|
7270
7275
|
bDownload = false;
|
|
7271
7276
|
return downloadRecordGetter();
|
|
7272
7277
|
};
|
|
7273
|
-
holder(
|
|
7274
|
-
blob,
|
|
7275
|
-
metaInfo,
|
|
7276
|
-
cancelAutoDownload
|
|
7277
|
-
);
|
|
7278
|
+
holder(blob, metaInfo, cancelAutoDownload);
|
|
7278
7279
|
return bDownload;
|
|
7279
7280
|
}
|
|
7280
7281
|
return true;
|
|
@@ -12848,10 +12849,20 @@ var RecordStatePlugin = class extends Plugin {
|
|
|
12848
12849
|
}
|
|
12849
12850
|
init(_container) {
|
|
12850
12851
|
const el = this.el;
|
|
12851
|
-
const svgRecord = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256" style="vertical-align: sub;" ><rect width="256" height="256" fill="none"/><circle cx="127" cy="129" r="81" fill="#dd2c2c" fill-rule="evenodd"/></svg>`;
|
|
12852
|
+
const svgRecord = `<svg class='blinking-element' xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256" style="vertical-align: sub;" ><rect width="256" height="256" fill="none"/><circle cx="127" cy="129" r="81" fill="#dd2c2c" fill-rule="evenodd"/></svg>`;
|
|
12852
12853
|
el.style.display = "none";
|
|
12853
|
-
const spinEl = core_default.dom.create("
|
|
12854
|
-
spinEl.innerHTML = `${svgRecord}
|
|
12854
|
+
const spinEl = core_default.dom.create("div");
|
|
12855
|
+
spinEl.innerHTML = `${svgRecord}`;
|
|
12856
|
+
spinEl.style.color = "black";
|
|
12857
|
+
spinEl.style.backgroundColor = "white";
|
|
12858
|
+
spinEl.style.margin = "5px 5px";
|
|
12859
|
+
spinEl.style.padding = "2px 5px 2px 1px";
|
|
12860
|
+
spinEl.style.top = "5px";
|
|
12861
|
+
spinEl.style.left = "5px";
|
|
12862
|
+
spinEl.style.borderRadius = "4px";
|
|
12863
|
+
const sliceSpan = document.createElement("span");
|
|
12864
|
+
spinEl.appendChild(sliceSpan);
|
|
12865
|
+
sliceSpan.innerHTML = "00:00:00";
|
|
12855
12866
|
core_default.dom.append(el, spinEl);
|
|
12856
12867
|
this.spanEle = spinEl;
|
|
12857
12868
|
let recordStart = 0;
|
|
@@ -12866,7 +12877,7 @@ var RecordStatePlugin = class extends Plugin {
|
|
|
12866
12877
|
const mins = formatTime(lastTime, 60);
|
|
12867
12878
|
const seconds = Math.floor(lastTime % 60);
|
|
12868
12879
|
const fomatSeconds = seconds > 9 ? seconds : "0" + seconds;
|
|
12869
|
-
|
|
12880
|
+
sliceSpan.innerHTML = `${hour + mins + fomatSeconds}`;
|
|
12870
12881
|
}
|
|
12871
12882
|
this.addEventListener("RecordStart", () => {
|
|
12872
12883
|
if (this.el) {
|
|
@@ -12881,7 +12892,7 @@ var RecordStatePlugin = class extends Plugin {
|
|
|
12881
12892
|
});
|
|
12882
12893
|
this.addEventListener("RecordEnd", () => {
|
|
12883
12894
|
if (this.el) {
|
|
12884
|
-
|
|
12895
|
+
sliceSpan.innerHTML = "00:00:00";
|
|
12885
12896
|
this.el.style.display = "none";
|
|
12886
12897
|
}
|
|
12887
12898
|
if (this.intervalToken) {
|
|
@@ -13146,8 +13157,14 @@ var PlayerPlugin = class extends Plugin {
|
|
|
13146
13157
|
let bDownload = true;
|
|
13147
13158
|
this.dispatch("screenshot", screenshotResult && screenshotResult.blob ? {
|
|
13148
13159
|
img: screenshotResult.blob,
|
|
13160
|
+
fileName: screenshotResult.fileName,
|
|
13149
13161
|
cancelAutoDownload() {
|
|
13150
13162
|
bDownload = false;
|
|
13163
|
+
return {
|
|
13164
|
+
download(fileName) {
|
|
13165
|
+
screenshotResult == null ? void 0 : screenshotResult.download(fileName);
|
|
13166
|
+
}
|
|
13167
|
+
};
|
|
13151
13168
|
}
|
|
13152
13169
|
} : void 0);
|
|
13153
13170
|
if (bDownload && (screenshotResult == null ? void 0 : screenshotResult.download)) {
|
|
@@ -16376,6 +16393,7 @@ function CreatePlayerState(player) {
|
|
|
16376
16393
|
return player.addEventListener("screenshot", (data) => {
|
|
16377
16394
|
handleUtils.dispatch({
|
|
16378
16395
|
img: data == null ? void 0 : data.img,
|
|
16396
|
+
fileName: data == null ? void 0 : data.fileName,
|
|
16379
16397
|
cancelAutoDownload: data == null ? void 0 : data.cancelAutoDownload
|
|
16380
16398
|
});
|
|
16381
16399
|
});
|
|
@@ -22,15 +22,18 @@ export declare function CreatePlayerState(player: PlayerPlugin): {
|
|
|
22
22
|
}>;
|
|
23
23
|
screenshot: IDataHandle<{
|
|
24
24
|
img?: Blob | undefined;
|
|
25
|
+
fileName?: string | undefined;
|
|
25
26
|
cancelAutoDownload?: (() => void) | undefined;
|
|
26
27
|
}> | {
|
|
27
28
|
exec(): void;
|
|
28
29
|
addEventListener: (handle: (data: {
|
|
29
30
|
img?: Blob | undefined;
|
|
31
|
+
fileName?: string | undefined;
|
|
30
32
|
cancelAutoDownload?: (() => void) | undefined;
|
|
31
33
|
}) => void) => () => void;
|
|
32
34
|
removeEventListener: (handle: (data: {
|
|
33
35
|
img?: Blob | undefined;
|
|
36
|
+
fileName?: string | undefined;
|
|
34
37
|
cancelAutoDownload?: (() => void) | undefined;
|
|
35
38
|
}) => void) => void;
|
|
36
39
|
};
|
|
@@ -37,7 +37,10 @@ export interface IPlayerPluginEventMap extends IPluginEventMap {
|
|
|
37
37
|
recordStop: IRecordStopInfo;
|
|
38
38
|
screenshot: undefined | {
|
|
39
39
|
img: Blob;
|
|
40
|
-
|
|
40
|
+
fileName: string;
|
|
41
|
+
cancelAutoDownload: () => {
|
|
42
|
+
download(fileName?: string): void;
|
|
43
|
+
};
|
|
41
44
|
};
|
|
42
45
|
fullscreen: boolean;
|
|
43
46
|
rotate: IRotateEvent;
|
|
@@ -49,7 +49,8 @@ declare class VideoPlugin extends Plugin<HTMLDivElement, IVideoPluginEventMap> {
|
|
|
49
49
|
pause(): void;
|
|
50
50
|
screenshot(): Promise<{
|
|
51
51
|
blob: Blob | null;
|
|
52
|
-
|
|
52
|
+
fileName: string;
|
|
53
|
+
download(fileNameCaller?: string | undefined): void;
|
|
53
54
|
} | undefined>;
|
|
54
55
|
private _genFileName;
|
|
55
56
|
recordStart(): void;
|
|
@@ -45,11 +45,13 @@ declare const media: {
|
|
|
45
45
|
canvasToBlob: (canvas: HTMLCanvasElement) => Promise<Blob | null>;
|
|
46
46
|
screenshotByCanvas: (canvas?: HTMLCanvasElement | null, fileName?: string) => Promise<{
|
|
47
47
|
blob: Blob | null;
|
|
48
|
-
|
|
48
|
+
fileName: string;
|
|
49
|
+
download(fileNameCaller?: string): void;
|
|
49
50
|
} | undefined>;
|
|
50
51
|
screenshot: (videoEl?: HTMLVideoElement | null, fileName?: string) => Promise<{
|
|
51
52
|
blob: Blob | null;
|
|
52
|
-
|
|
53
|
+
fileName: string;
|
|
54
|
+
download(fileNameCaller?: string): void;
|
|
53
55
|
} | undefined>;
|
|
54
56
|
record: (element: IStreamProvider, stream?: MediaStream | null, fileName?: string) => [(MediaRecorder | undefined)?, (MediaStream | undefined)?, ({
|
|
55
57
|
setOnMedia(onMedia: IOnMediaRecordHandle): void;
|