@besovideo/webrtc-player 0.8.41 → 0.8.43
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
CHANGED
|
@@ -77,7 +77,7 @@ var bvPlayerCore = (() => {
|
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
// <define:process.env>
|
|
80
|
-
var define_process_env_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.
|
|
80
|
+
var define_process_env_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.43", PROJECT_NAMESPACE: "bvplayer" };
|
|
81
81
|
|
|
82
82
|
// node_modules/@shirtiny/logger/dist/main.es.js
|
|
83
83
|
var _ = Object.defineProperty;
|
|
@@ -4725,9 +4725,10 @@ var bvPlayerCore = (() => {
|
|
|
4725
4725
|
yield screenshotByCanvas(canvas, fileName);
|
|
4726
4726
|
});
|
|
4727
4727
|
var record = (element, stream, fileName = `record_${Date.now()}`) => {
|
|
4728
|
-
const options = { mimeType: "video/webm; codecs=vp9" };
|
|
4729
4728
|
try {
|
|
4730
4729
|
const mediaStream = stream || element.captureStream(25);
|
|
4730
|
+
const hasVideo = mediaStream.getVideoTracks().length > 0;
|
|
4731
|
+
const options = hasVideo ? { mimeType: "video/webm; codecs=vp9,opus" } : { mimeType: "audio/webm; codecs=opus" };
|
|
4731
4732
|
logger_default.info("\u6355\u83B7\u7684\u6D41\u548C\u5F55\u5236\u914D\u7F6E\u9879\uFF1A", mediaStream, options);
|
|
4732
4733
|
let recordedChunks = [];
|
|
4733
4734
|
const mediaRecorder = new MediaRecorder(mediaStream, options);
|
|
@@ -4979,6 +4980,9 @@ var bvPlayerCore = (() => {
|
|
|
4979
4980
|
this._canvasEl = newEl;
|
|
4980
4981
|
this._mediaStream = null;
|
|
4981
4982
|
}
|
|
4983
|
+
setCaptureProvider(capture) {
|
|
4984
|
+
this._captureStream = capture;
|
|
4985
|
+
}
|
|
4982
4986
|
play() {
|
|
4983
4987
|
return __async(this, null, function* () {
|
|
4984
4988
|
const el = this._videoEl;
|
|
@@ -5016,7 +5020,12 @@ var bvPlayerCore = (() => {
|
|
|
5016
5020
|
if (this._recorder) {
|
|
5017
5021
|
this.recordStop();
|
|
5018
5022
|
}
|
|
5019
|
-
const
|
|
5023
|
+
const captureStream = () => {
|
|
5024
|
+
if (this._captureStream) {
|
|
5025
|
+
return this._captureStream();
|
|
5026
|
+
}
|
|
5027
|
+
};
|
|
5028
|
+
const streamEl = this.canvasEnabled ? { captureStream } : this._videoEl;
|
|
5020
5029
|
if (!streamEl)
|
|
5021
5030
|
return;
|
|
5022
5031
|
const fileName = this._genFileName("record");
|
|
@@ -9720,7 +9729,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
9720
9729
|
return __async(this, null, function* () {
|
|
9721
9730
|
if (!this._isInClose) {
|
|
9722
9731
|
this._isInClose = true;
|
|
9723
|
-
|
|
9732
|
+
this.dispatch("close");
|
|
9724
9733
|
this.closeWebrtc();
|
|
9725
9734
|
}
|
|
9726
9735
|
});
|
|
@@ -9986,8 +9995,9 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
9986
9995
|
}
|
|
9987
9996
|
});
|
|
9988
9997
|
}
|
|
9989
|
-
enableCanvas(enable) {
|
|
9998
|
+
enableCanvas(enable, captureStream) {
|
|
9990
9999
|
this._video.canvasEnabled = !!enable;
|
|
10000
|
+
this._video.setCaptureProvider(captureStream);
|
|
9991
10001
|
}
|
|
9992
10002
|
replaceCanvas(canvas) {
|
|
9993
10003
|
this._video.setCanvasEl(canvas);
|
|
@@ -10222,6 +10232,38 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
10222
10232
|
this.init_callback();
|
|
10223
10233
|
}
|
|
10224
10234
|
}
|
|
10235
|
+
captureStream() {
|
|
10236
|
+
const audioTracks = [];
|
|
10237
|
+
const videoTracks = [];
|
|
10238
|
+
if (this.audioPlayer) {
|
|
10239
|
+
const audioStream = this.audioPlayer.getAudioStream();
|
|
10240
|
+
audioStream == null ? void 0 : audioStream.getAudioTracks().forEach((track) => {
|
|
10241
|
+
audioTracks.push(track);
|
|
10242
|
+
});
|
|
10243
|
+
}
|
|
10244
|
+
let hasVideo = (this.mediaDir & 2) == 2;
|
|
10245
|
+
if (hasVideo) {
|
|
10246
|
+
if (this.videoInfo.webcodecs) {
|
|
10247
|
+
if (this.videoPlayer && this.videoPlayer.mContainer.srcObject) {
|
|
10248
|
+
const mediaStram = this.videoPlayer.mContainer.srcObject;
|
|
10249
|
+
if (mediaStram) {
|
|
10250
|
+
mediaStram == null ? void 0 : mediaStram.getAudioTracks().forEach((track) => {
|
|
10251
|
+
audioTracks.push(track);
|
|
10252
|
+
});
|
|
10253
|
+
mediaStram == null ? void 0 : mediaStram.getVideoTracks().forEach((track) => {
|
|
10254
|
+
videoTracks.push(track);
|
|
10255
|
+
});
|
|
10256
|
+
}
|
|
10257
|
+
}
|
|
10258
|
+
} else if (this.canvas) {
|
|
10259
|
+
const canvasStream = this.canvas.captureStream(24);
|
|
10260
|
+
canvasStream == null ? void 0 : canvasStream.getVideoTracks().forEach((track) => {
|
|
10261
|
+
videoTracks.push(track);
|
|
10262
|
+
});
|
|
10263
|
+
}
|
|
10264
|
+
}
|
|
10265
|
+
return new MediaStream([...audioTracks, ...videoTracks]);
|
|
10266
|
+
}
|
|
10225
10267
|
_OnOpen({ hplayer }) {
|
|
10226
10268
|
this.hplayer = hplayer;
|
|
10227
10269
|
console.log("open player ok! " + hplayer);
|
|
@@ -10360,6 +10402,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
10360
10402
|
this.interval = setInterval(this.flush, this.option.flushingTime);
|
|
10361
10403
|
this.maxValue = this.getMaxValue();
|
|
10362
10404
|
this.typedArray = this.getTypedArray();
|
|
10405
|
+
this.audioStream = null;
|
|
10363
10406
|
this.createContext();
|
|
10364
10407
|
};
|
|
10365
10408
|
BVPCMPlayer.prototype.getMaxValue = function() {
|
|
@@ -10380,12 +10423,19 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
10380
10423
|
};
|
|
10381
10424
|
return typedArrays[this.option.encoding] ? typedArrays[this.option.encoding] : typedArrays["s16"];
|
|
10382
10425
|
};
|
|
10426
|
+
BVPCMPlayer.prototype.getAudioStream = function() {
|
|
10427
|
+
return this.audioStream;
|
|
10428
|
+
};
|
|
10383
10429
|
BVPCMPlayer.prototype.createContext = function() {
|
|
10384
10430
|
this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
10385
10431
|
this.audioCtx.resume();
|
|
10386
10432
|
this.gainNode = this.audioCtx.createGain();
|
|
10387
10433
|
this.gainNode.gain.value = 1;
|
|
10388
|
-
this.
|
|
10434
|
+
const dest = this.audioCtx.createMediaStreamDestination();
|
|
10435
|
+
this.gainNode.connect(dest);
|
|
10436
|
+
const videoEle = document.createElement("video");
|
|
10437
|
+
videoEle.srcObject = this.audioStream = dest.stream;
|
|
10438
|
+
videoEle.play();
|
|
10389
10439
|
this.startTime = this.audioCtx.currentTime;
|
|
10390
10440
|
};
|
|
10391
10441
|
BVPCMPlayer.prototype.isTypedArray = function(data) {
|
|
@@ -10414,6 +10464,10 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
10414
10464
|
if (this.interval) {
|
|
10415
10465
|
clearInterval(this.interval);
|
|
10416
10466
|
}
|
|
10467
|
+
if (this.audioStream) {
|
|
10468
|
+
this.audioStream.getAudioTracks().forEach((item) => item.stop());
|
|
10469
|
+
this.audioStream = null;
|
|
10470
|
+
}
|
|
10417
10471
|
this.samples = null;
|
|
10418
10472
|
this.audioCtx.close();
|
|
10419
10473
|
this.audioCtx = null;
|
|
@@ -11995,7 +12049,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
11995
12049
|
case "f32-planar":
|
|
11996
12050
|
tempArray = new Float32Array(dataArray.buffer);
|
|
11997
12051
|
byteCount = 4;
|
|
11998
|
-
iConstMaxData =
|
|
12052
|
+
iConstMaxData = 1;
|
|
11999
12053
|
break;
|
|
12000
12054
|
}
|
|
12001
12055
|
const iPastMs = 1e3 / sampleRate * dataArray.length / byteCount;
|
|
@@ -12353,7 +12407,8 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
12353
12407
|
logger_default.debug("error\u7684\u7C7B\u578B", e.name, e instanceof OpenDialogError);
|
|
12354
12408
|
if (e instanceof OpenDialogError || protocol === "webrtc")
|
|
12355
12409
|
throw e;
|
|
12356
|
-
|
|
12410
|
+
const captureStream = () => hplayer == null ? void 0 : hplayer.captureStream();
|
|
12411
|
+
player.enableCanvas(true, captureStream);
|
|
12357
12412
|
this.protocol = "ws-bvrtc";
|
|
12358
12413
|
hplayer = new BVMedia();
|
|
12359
12414
|
if (noVideoRendeAudioWaveform && !defaultMediaOption.video) {
|
|
@@ -12450,7 +12505,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
12450
12505
|
const audioList = [
|
|
12451
12506
|
{
|
|
12452
12507
|
label: t("codec"),
|
|
12453
|
-
value: hplayer.getAudioInfo().codec
|
|
12508
|
+
value: hplayer.getAudioInfo().codec + (hplayer.getAudioInfo().webcodecs ? "(webcodecs)" : "")
|
|
12454
12509
|
},
|
|
12455
12510
|
{
|
|
12456
12511
|
label: t("sample-accuracy"),
|
package/dist/main.es.js
CHANGED
|
@@ -71,7 +71,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
// <define:process.env>
|
|
74
|
-
var define_process_env_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.
|
|
74
|
+
var define_process_env_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.43", PROJECT_NAMESPACE: "bvplayer" };
|
|
75
75
|
|
|
76
76
|
// node_modules/@shirtiny/logger/dist/main.es.js
|
|
77
77
|
var _ = Object.defineProperty;
|
|
@@ -4709,9 +4709,10 @@ var screenshot = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (videoEl,
|
|
|
4709
4709
|
yield screenshotByCanvas(canvas, fileName);
|
|
4710
4710
|
});
|
|
4711
4711
|
var record = (element, stream, fileName = `record_${Date.now()}`) => {
|
|
4712
|
-
const options = { mimeType: "video/webm; codecs=vp9" };
|
|
4713
4712
|
try {
|
|
4714
4713
|
const mediaStream = stream || element.captureStream(25);
|
|
4714
|
+
const hasVideo = mediaStream.getVideoTracks().length > 0;
|
|
4715
|
+
const options = hasVideo ? { mimeType: "video/webm; codecs=vp9,opus" } : { mimeType: "audio/webm; codecs=opus" };
|
|
4715
4716
|
logger_default.info("\u6355\u83B7\u7684\u6D41\u548C\u5F55\u5236\u914D\u7F6E\u9879\uFF1A", mediaStream, options);
|
|
4716
4717
|
let recordedChunks = [];
|
|
4717
4718
|
const mediaRecorder = new MediaRecorder(mediaStream, options);
|
|
@@ -4963,6 +4964,9 @@ var VideoPlugin = class extends Plugin {
|
|
|
4963
4964
|
this._canvasEl = newEl;
|
|
4964
4965
|
this._mediaStream = null;
|
|
4965
4966
|
}
|
|
4967
|
+
setCaptureProvider(capture) {
|
|
4968
|
+
this._captureStream = capture;
|
|
4969
|
+
}
|
|
4966
4970
|
play() {
|
|
4967
4971
|
return __async(this, null, function* () {
|
|
4968
4972
|
const el = this._videoEl;
|
|
@@ -5000,7 +5004,12 @@ var VideoPlugin = class extends Plugin {
|
|
|
5000
5004
|
if (this._recorder) {
|
|
5001
5005
|
this.recordStop();
|
|
5002
5006
|
}
|
|
5003
|
-
const
|
|
5007
|
+
const captureStream = () => {
|
|
5008
|
+
if (this._captureStream) {
|
|
5009
|
+
return this._captureStream();
|
|
5010
|
+
}
|
|
5011
|
+
};
|
|
5012
|
+
const streamEl = this.canvasEnabled ? { captureStream } : this._videoEl;
|
|
5004
5013
|
if (!streamEl)
|
|
5005
5014
|
return;
|
|
5006
5015
|
const fileName = this._genFileName("record");
|
|
@@ -9704,7 +9713,7 @@ var PlayerPlugin = class extends Plugin {
|
|
|
9704
9713
|
return __async(this, null, function* () {
|
|
9705
9714
|
if (!this._isInClose) {
|
|
9706
9715
|
this._isInClose = true;
|
|
9707
|
-
|
|
9716
|
+
this.dispatch("close");
|
|
9708
9717
|
this.closeWebrtc();
|
|
9709
9718
|
}
|
|
9710
9719
|
});
|
|
@@ -9970,8 +9979,9 @@ var PlayerPlugin = class extends Plugin {
|
|
|
9970
9979
|
}
|
|
9971
9980
|
});
|
|
9972
9981
|
}
|
|
9973
|
-
enableCanvas(enable) {
|
|
9982
|
+
enableCanvas(enable, captureStream) {
|
|
9974
9983
|
this._video.canvasEnabled = !!enable;
|
|
9984
|
+
this._video.setCaptureProvider(captureStream);
|
|
9975
9985
|
}
|
|
9976
9986
|
replaceCanvas(canvas) {
|
|
9977
9987
|
this._video.setCanvasEl(canvas);
|
|
@@ -10206,6 +10216,38 @@ var BVMedia = class {
|
|
|
10206
10216
|
this.init_callback();
|
|
10207
10217
|
}
|
|
10208
10218
|
}
|
|
10219
|
+
captureStream() {
|
|
10220
|
+
const audioTracks = [];
|
|
10221
|
+
const videoTracks = [];
|
|
10222
|
+
if (this.audioPlayer) {
|
|
10223
|
+
const audioStream = this.audioPlayer.getAudioStream();
|
|
10224
|
+
audioStream == null ? void 0 : audioStream.getAudioTracks().forEach((track) => {
|
|
10225
|
+
audioTracks.push(track);
|
|
10226
|
+
});
|
|
10227
|
+
}
|
|
10228
|
+
let hasVideo = (this.mediaDir & 2) == 2;
|
|
10229
|
+
if (hasVideo) {
|
|
10230
|
+
if (this.videoInfo.webcodecs) {
|
|
10231
|
+
if (this.videoPlayer && this.videoPlayer.mContainer.srcObject) {
|
|
10232
|
+
const mediaStram = this.videoPlayer.mContainer.srcObject;
|
|
10233
|
+
if (mediaStram) {
|
|
10234
|
+
mediaStram == null ? void 0 : mediaStram.getAudioTracks().forEach((track) => {
|
|
10235
|
+
audioTracks.push(track);
|
|
10236
|
+
});
|
|
10237
|
+
mediaStram == null ? void 0 : mediaStram.getVideoTracks().forEach((track) => {
|
|
10238
|
+
videoTracks.push(track);
|
|
10239
|
+
});
|
|
10240
|
+
}
|
|
10241
|
+
}
|
|
10242
|
+
} else if (this.canvas) {
|
|
10243
|
+
const canvasStream = this.canvas.captureStream(24);
|
|
10244
|
+
canvasStream == null ? void 0 : canvasStream.getVideoTracks().forEach((track) => {
|
|
10245
|
+
videoTracks.push(track);
|
|
10246
|
+
});
|
|
10247
|
+
}
|
|
10248
|
+
}
|
|
10249
|
+
return new MediaStream([...audioTracks, ...videoTracks]);
|
|
10250
|
+
}
|
|
10209
10251
|
_OnOpen({ hplayer }) {
|
|
10210
10252
|
this.hplayer = hplayer;
|
|
10211
10253
|
console.log("open player ok! " + hplayer);
|
|
@@ -10344,6 +10386,7 @@ BVPCMPlayer.prototype.init = function(option) {
|
|
|
10344
10386
|
this.interval = setInterval(this.flush, this.option.flushingTime);
|
|
10345
10387
|
this.maxValue = this.getMaxValue();
|
|
10346
10388
|
this.typedArray = this.getTypedArray();
|
|
10389
|
+
this.audioStream = null;
|
|
10347
10390
|
this.createContext();
|
|
10348
10391
|
};
|
|
10349
10392
|
BVPCMPlayer.prototype.getMaxValue = function() {
|
|
@@ -10364,12 +10407,19 @@ BVPCMPlayer.prototype.getTypedArray = function() {
|
|
|
10364
10407
|
};
|
|
10365
10408
|
return typedArrays[this.option.encoding] ? typedArrays[this.option.encoding] : typedArrays["s16"];
|
|
10366
10409
|
};
|
|
10410
|
+
BVPCMPlayer.prototype.getAudioStream = function() {
|
|
10411
|
+
return this.audioStream;
|
|
10412
|
+
};
|
|
10367
10413
|
BVPCMPlayer.prototype.createContext = function() {
|
|
10368
10414
|
this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
10369
10415
|
this.audioCtx.resume();
|
|
10370
10416
|
this.gainNode = this.audioCtx.createGain();
|
|
10371
10417
|
this.gainNode.gain.value = 1;
|
|
10372
|
-
this.
|
|
10418
|
+
const dest = this.audioCtx.createMediaStreamDestination();
|
|
10419
|
+
this.gainNode.connect(dest);
|
|
10420
|
+
const videoEle = document.createElement("video");
|
|
10421
|
+
videoEle.srcObject = this.audioStream = dest.stream;
|
|
10422
|
+
videoEle.play();
|
|
10373
10423
|
this.startTime = this.audioCtx.currentTime;
|
|
10374
10424
|
};
|
|
10375
10425
|
BVPCMPlayer.prototype.isTypedArray = function(data) {
|
|
@@ -10398,6 +10448,10 @@ BVPCMPlayer.prototype.destroy = function() {
|
|
|
10398
10448
|
if (this.interval) {
|
|
10399
10449
|
clearInterval(this.interval);
|
|
10400
10450
|
}
|
|
10451
|
+
if (this.audioStream) {
|
|
10452
|
+
this.audioStream.getAudioTracks().forEach((item) => item.stop());
|
|
10453
|
+
this.audioStream = null;
|
|
10454
|
+
}
|
|
10401
10455
|
this.samples = null;
|
|
10402
10456
|
this.audioCtx.close();
|
|
10403
10457
|
this.audioCtx = null;
|
|
@@ -11979,7 +12033,7 @@ var MediaStreamAudioWaveShowBVRtc = class {
|
|
|
11979
12033
|
case "f32-planar":
|
|
11980
12034
|
tempArray = new Float32Array(dataArray.buffer);
|
|
11981
12035
|
byteCount = 4;
|
|
11982
|
-
iConstMaxData =
|
|
12036
|
+
iConstMaxData = 1;
|
|
11983
12037
|
break;
|
|
11984
12038
|
}
|
|
11985
12039
|
const iPastMs = 1e3 / sampleRate * dataArray.length / byteCount;
|
|
@@ -12337,7 +12391,8 @@ var PuPlayer = (props) => {
|
|
|
12337
12391
|
logger_default.debug("error\u7684\u7C7B\u578B", e.name, e instanceof OpenDialogError);
|
|
12338
12392
|
if (e instanceof OpenDialogError || protocol === "webrtc")
|
|
12339
12393
|
throw e;
|
|
12340
|
-
|
|
12394
|
+
const captureStream = () => hplayer == null ? void 0 : hplayer.captureStream();
|
|
12395
|
+
player.enableCanvas(true, captureStream);
|
|
12341
12396
|
this.protocol = "ws-bvrtc";
|
|
12342
12397
|
hplayer = new BVMedia();
|
|
12343
12398
|
if (noVideoRendeAudioWaveform && !defaultMediaOption.video) {
|
|
@@ -12434,7 +12489,7 @@ var PuPlayer = (props) => {
|
|
|
12434
12489
|
const audioList = [
|
|
12435
12490
|
{
|
|
12436
12491
|
label: t("codec"),
|
|
12437
|
-
value: hplayer.getAudioInfo().codec
|
|
12492
|
+
value: hplayer.getAudioInfo().codec + (hplayer.getAudioInfo().webcodecs ? "(webcodecs)" : "")
|
|
12438
12493
|
},
|
|
12439
12494
|
{
|
|
12440
12495
|
label: t("sample-accuracy"),
|
|
@@ -92,7 +92,7 @@ declare class PlayerPlugin extends Plugin<HTMLDivElement, IPlayerPluginEventMap>
|
|
|
92
92
|
private closeWebrtc;
|
|
93
93
|
private refreshInfoModal;
|
|
94
94
|
togglePtz(): Promise<void>;
|
|
95
|
-
enableCanvas(enable: boolean): void;
|
|
95
|
+
enableCanvas(enable: boolean, captureStream?: () => MediaStream): void;
|
|
96
96
|
replaceCanvas(canvas: HTMLCanvasElement): void;
|
|
97
97
|
setVideoFit(fit: keyof IVideoFits): void;
|
|
98
98
|
fullscreen(): void;
|
|
@@ -42,6 +42,8 @@ declare class VideoPlugin extends Plugin<HTMLDivElement, IVideoPluginEventMap> {
|
|
|
42
42
|
getVideoEl(): HTMLVideoElement;
|
|
43
43
|
getCanvasEl(): HTMLCanvasElement;
|
|
44
44
|
setCanvasEl(newEl: HTMLCanvasElement): void;
|
|
45
|
+
private _captureStream;
|
|
46
|
+
setCaptureProvider(capture?: () => MediaStream): void;
|
|
45
47
|
play(): Promise<void>;
|
|
46
48
|
pause(): void;
|
|
47
49
|
screenshot(): void;
|
package/package.json
CHANGED