@besovideo/webrtc-player 0.8.61 → 0.8.63
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 +50 -22
- package/dist/main.es.js +50 -22
- 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.8.
|
|
120
|
+
define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.62", PROJECT_NAMESPACE: "bvplayer" };
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
|
|
@@ -10354,7 +10354,7 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
10354
10354
|
}
|
|
10355
10355
|
function combinaWebM(webM1, webM2) {
|
|
10356
10356
|
return __async(this, null, function* () {
|
|
10357
|
-
var _a, _b;
|
|
10357
|
+
var _a, _b, _c, _d, _e;
|
|
10358
10358
|
const stream0 = webM1 ? yield GetDemuxer(webM1) : webM1;
|
|
10359
10359
|
const stream1 = webM2 ? yield GetDemuxer(webM2) : webM2;
|
|
10360
10360
|
let audio;
|
|
@@ -10362,13 +10362,13 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
10362
10362
|
if ((stream0 == null ? void 0 : stream0.tracks[1].type) == "audio") {
|
|
10363
10363
|
audio = stream0;
|
|
10364
10364
|
}
|
|
10365
|
-
if ((stream1 == null ? void 0 : stream1.tracks[1].type) == "audio") {
|
|
10365
|
+
if (((_a = stream1 == null ? void 0 : stream1.tracks[1]) == null ? void 0 : _a.type) == "audio") {
|
|
10366
10366
|
audio = stream1;
|
|
10367
10367
|
}
|
|
10368
|
-
if ((stream0 == null ? void 0 : stream0.tracks[1].type) == "video") {
|
|
10368
|
+
if (((_b = stream0 == null ? void 0 : stream0.tracks[1]) == null ? void 0 : _b.type) == "video") {
|
|
10369
10369
|
video = stream0;
|
|
10370
10370
|
}
|
|
10371
|
-
if ((stream1 == null ? void 0 : stream1.tracks[1].type) == "video") {
|
|
10371
|
+
if (((_c = stream1 == null ? void 0 : stream1.tracks[1]) == null ? void 0 : _c.type) == "video") {
|
|
10372
10372
|
video = stream1;
|
|
10373
10373
|
}
|
|
10374
10374
|
const videoTrackInfo = video == null ? void 0 : video.tracks[1];
|
|
@@ -10393,22 +10393,30 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
10393
10393
|
streaming: false
|
|
10394
10394
|
}));
|
|
10395
10395
|
const parser = SimpleBlockParser();
|
|
10396
|
-
video == null ? void 0 : video.elements.filter((item) => item.type == "b").forEach((simpleBlock) => {
|
|
10396
|
+
video == null ? void 0 : video.elements.filter((item) => item.type == "b" || item.name == "BlockGroup").forEach((simpleBlock) => {
|
|
10397
|
+
if (simpleBlock.name == "BlockGroup") {
|
|
10398
|
+
const tempBlock = simpleBlock.childs.find((item) => item.type == "b");
|
|
10399
|
+
if (tempBlock) {
|
|
10400
|
+
simpleBlock = tempBlock;
|
|
10401
|
+
}
|
|
10402
|
+
}
|
|
10397
10403
|
const [timestamp, data, bKeyFrame] = parser.parse(simpleBlock, 0);
|
|
10398
10404
|
muxer.addVideoChunkRaw(data, bKeyFrame ? "key" : "delta", timestamp);
|
|
10399
10405
|
});
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10406
|
+
if (audio) {
|
|
10407
|
+
const audioCodecPrivate = (_e = (_d = audio == null ? void 0 : audio.elements.find((item) => item.name == "Tracks")) == null ? void 0 : _d.childs[0].childs.find((item) => item.name == "CodecPrivate")) == null ? void 0 : _e.data;
|
|
10408
|
+
const config = {
|
|
10409
|
+
decoderConfig: {
|
|
10410
|
+
sampleRate: (audioTrackInfo == null ? void 0 : audioTrackInfo.metadata).SamplingFrequency,
|
|
10411
|
+
numberOfChannels: (audioTrackInfo == null ? void 0 : audioTrackInfo.metadata).Channels,
|
|
10412
|
+
description: audioCodecPrivate
|
|
10413
|
+
}
|
|
10414
|
+
};
|
|
10415
|
+
audio == null ? void 0 : audio.elements.filter((item) => item.type == "b").forEach((simpleBlock) => {
|
|
10416
|
+
const [timestamp, data] = parser.parse(simpleBlock, 1);
|
|
10417
|
+
muxer.addAudioChunkRaw(data, "key", timestamp, config);
|
|
10418
|
+
});
|
|
10419
|
+
}
|
|
10412
10420
|
muxer.finalize();
|
|
10413
10421
|
return new Blob([muxer.target.buffer]);
|
|
10414
10422
|
});
|
|
@@ -10448,13 +10456,17 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
10448
10456
|
return mediaRecorder;
|
|
10449
10457
|
};
|
|
10450
10458
|
var createRecord = (_mediaStream, fileName) => {
|
|
10451
|
-
const
|
|
10459
|
+
const tempMediaStreams = _mediaStream.getTracks().map((item) => {
|
|
10452
10460
|
const mediaStream2 = new MediaStream([item]);
|
|
10453
10461
|
item.addEventListener("ended", () => {
|
|
10454
10462
|
mediaStream2.getTracks().forEach((item2) => item2.stop());
|
|
10455
10463
|
});
|
|
10456
10464
|
return new MediaStream([item]);
|
|
10457
10465
|
});
|
|
10466
|
+
const mediaStreams = [
|
|
10467
|
+
...tempMediaStreams.filter((item) => item.getVideoTracks().length > 0),
|
|
10468
|
+
...tempMediaStreams.filter((item) => item.getAudioTracks().length > 0)
|
|
10469
|
+
];
|
|
10458
10470
|
const mediaStream = mediaStreams[0];
|
|
10459
10471
|
let recordedChunks = [];
|
|
10460
10472
|
const szWebM = [];
|
|
@@ -12032,7 +12044,21 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
12032
12044
|
if (targetReceivers.length > 0) {
|
|
12033
12045
|
report = yield targetReceivers[0].getStats();
|
|
12034
12046
|
}
|
|
12035
|
-
|
|
12047
|
+
const isTargeReportExist = {
|
|
12048
|
+
codec: false,
|
|
12049
|
+
"inbound-rtp": false
|
|
12050
|
+
};
|
|
12051
|
+
Object.keys(isTargeReportExist).forEach((typeStats) => {
|
|
12052
|
+
if (report) {
|
|
12053
|
+
report.forEach((item) => {
|
|
12054
|
+
if (item.type == typeStats) {
|
|
12055
|
+
isTargeReportExist[typeStats] = true;
|
|
12056
|
+
}
|
|
12057
|
+
});
|
|
12058
|
+
}
|
|
12059
|
+
});
|
|
12060
|
+
const invalid = Object.keys(isTargeReportExist).findIndex((item) => !isTargeReportExist[item]) >= 0;
|
|
12061
|
+
return report && !invalid ? {
|
|
12036
12062
|
codec: __privateMethod(this, _getLastStatsByType, getLastStatsByType_fn).call(this, report, "codec", {}).now,
|
|
12037
12063
|
rtp: __privateMethod(this, _getLastStatsByType, getLastStatsByType_fn).call(this, report, "inbound-rtp", {
|
|
12038
12064
|
bytesReceived: 0,
|
|
@@ -19248,7 +19274,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
19248
19274
|
player.mikeBtn.type = this.protocol;
|
|
19249
19275
|
}
|
|
19250
19276
|
} catch (e) {
|
|
19251
|
-
if (signal.aborted) {
|
|
19277
|
+
if (signal.aborted && e != "protocol == ws-bvrtc" && type != "auto") {
|
|
19252
19278
|
player.mask.visible = true;
|
|
19253
19279
|
player.mask.text = t("connect-failed");
|
|
19254
19280
|
onConnectedFailed && onConnectedFailed();
|
|
@@ -19542,7 +19568,9 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
19542
19568
|
if (this.protocol == protocol)
|
|
19543
19569
|
return;
|
|
19544
19570
|
this.close().then(() => {
|
|
19545
|
-
|
|
19571
|
+
setTimeout(() => {
|
|
19572
|
+
this.open(currentMuted, protocol);
|
|
19573
|
+
}, 500);
|
|
19546
19574
|
});
|
|
19547
19575
|
},
|
|
19548
19576
|
setToken: (newToken) => {
|
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.62", PROJECT_NAMESPACE: "bvplayer" };
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
|
|
@@ -10340,7 +10340,7 @@ function SimpleBlockParser() {
|
|
|
10340
10340
|
}
|
|
10341
10341
|
function combinaWebM(webM1, webM2) {
|
|
10342
10342
|
return __async(this, null, function* () {
|
|
10343
|
-
var _a, _b;
|
|
10343
|
+
var _a, _b, _c, _d, _e;
|
|
10344
10344
|
const stream0 = webM1 ? yield GetDemuxer(webM1) : webM1;
|
|
10345
10345
|
const stream1 = webM2 ? yield GetDemuxer(webM2) : webM2;
|
|
10346
10346
|
let audio;
|
|
@@ -10348,13 +10348,13 @@ function combinaWebM(webM1, webM2) {
|
|
|
10348
10348
|
if ((stream0 == null ? void 0 : stream0.tracks[1].type) == "audio") {
|
|
10349
10349
|
audio = stream0;
|
|
10350
10350
|
}
|
|
10351
|
-
if ((stream1 == null ? void 0 : stream1.tracks[1].type) == "audio") {
|
|
10351
|
+
if (((_a = stream1 == null ? void 0 : stream1.tracks[1]) == null ? void 0 : _a.type) == "audio") {
|
|
10352
10352
|
audio = stream1;
|
|
10353
10353
|
}
|
|
10354
|
-
if ((stream0 == null ? void 0 : stream0.tracks[1].type) == "video") {
|
|
10354
|
+
if (((_b = stream0 == null ? void 0 : stream0.tracks[1]) == null ? void 0 : _b.type) == "video") {
|
|
10355
10355
|
video = stream0;
|
|
10356
10356
|
}
|
|
10357
|
-
if ((stream1 == null ? void 0 : stream1.tracks[1].type) == "video") {
|
|
10357
|
+
if (((_c = stream1 == null ? void 0 : stream1.tracks[1]) == null ? void 0 : _c.type) == "video") {
|
|
10358
10358
|
video = stream1;
|
|
10359
10359
|
}
|
|
10360
10360
|
const videoTrackInfo = video == null ? void 0 : video.tracks[1];
|
|
@@ -10379,22 +10379,30 @@ function combinaWebM(webM1, webM2) {
|
|
|
10379
10379
|
streaming: false
|
|
10380
10380
|
}));
|
|
10381
10381
|
const parser = SimpleBlockParser();
|
|
10382
|
-
video == null ? void 0 : video.elements.filter((item) => item.type == "b").forEach((simpleBlock) => {
|
|
10382
|
+
video == null ? void 0 : video.elements.filter((item) => item.type == "b" || item.name == "BlockGroup").forEach((simpleBlock) => {
|
|
10383
|
+
if (simpleBlock.name == "BlockGroup") {
|
|
10384
|
+
const tempBlock = simpleBlock.childs.find((item) => item.type == "b");
|
|
10385
|
+
if (tempBlock) {
|
|
10386
|
+
simpleBlock = tempBlock;
|
|
10387
|
+
}
|
|
10388
|
+
}
|
|
10383
10389
|
const [timestamp, data, bKeyFrame] = parser.parse(simpleBlock, 0);
|
|
10384
10390
|
muxer.addVideoChunkRaw(data, bKeyFrame ? "key" : "delta", timestamp);
|
|
10385
10391
|
});
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10392
|
+
if (audio) {
|
|
10393
|
+
const audioCodecPrivate = (_e = (_d = audio == null ? void 0 : audio.elements.find((item) => item.name == "Tracks")) == null ? void 0 : _d.childs[0].childs.find((item) => item.name == "CodecPrivate")) == null ? void 0 : _e.data;
|
|
10394
|
+
const config = {
|
|
10395
|
+
decoderConfig: {
|
|
10396
|
+
sampleRate: (audioTrackInfo == null ? void 0 : audioTrackInfo.metadata).SamplingFrequency,
|
|
10397
|
+
numberOfChannels: (audioTrackInfo == null ? void 0 : audioTrackInfo.metadata).Channels,
|
|
10398
|
+
description: audioCodecPrivate
|
|
10399
|
+
}
|
|
10400
|
+
};
|
|
10401
|
+
audio == null ? void 0 : audio.elements.filter((item) => item.type == "b").forEach((simpleBlock) => {
|
|
10402
|
+
const [timestamp, data] = parser.parse(simpleBlock, 1);
|
|
10403
|
+
muxer.addAudioChunkRaw(data, "key", timestamp, config);
|
|
10404
|
+
});
|
|
10405
|
+
}
|
|
10398
10406
|
muxer.finalize();
|
|
10399
10407
|
return new Blob([muxer.target.buffer]);
|
|
10400
10408
|
});
|
|
@@ -10434,13 +10442,17 @@ var createMediaRecorder = (mediaStream, done, mediaRecorderPartner) => {
|
|
|
10434
10442
|
return mediaRecorder;
|
|
10435
10443
|
};
|
|
10436
10444
|
var createRecord = (_mediaStream, fileName) => {
|
|
10437
|
-
const
|
|
10445
|
+
const tempMediaStreams = _mediaStream.getTracks().map((item) => {
|
|
10438
10446
|
const mediaStream2 = new MediaStream([item]);
|
|
10439
10447
|
item.addEventListener("ended", () => {
|
|
10440
10448
|
mediaStream2.getTracks().forEach((item2) => item2.stop());
|
|
10441
10449
|
});
|
|
10442
10450
|
return new MediaStream([item]);
|
|
10443
10451
|
});
|
|
10452
|
+
const mediaStreams = [
|
|
10453
|
+
...tempMediaStreams.filter((item) => item.getVideoTracks().length > 0),
|
|
10454
|
+
...tempMediaStreams.filter((item) => item.getAudioTracks().length > 0)
|
|
10455
|
+
];
|
|
10444
10456
|
const mediaStream = mediaStreams[0];
|
|
10445
10457
|
let recordedChunks = [];
|
|
10446
10458
|
const szWebM = [];
|
|
@@ -12018,7 +12030,21 @@ var WebRTCConnect = class {
|
|
|
12018
12030
|
if (targetReceivers.length > 0) {
|
|
12019
12031
|
report = yield targetReceivers[0].getStats();
|
|
12020
12032
|
}
|
|
12021
|
-
|
|
12033
|
+
const isTargeReportExist = {
|
|
12034
|
+
codec: false,
|
|
12035
|
+
"inbound-rtp": false
|
|
12036
|
+
};
|
|
12037
|
+
Object.keys(isTargeReportExist).forEach((typeStats) => {
|
|
12038
|
+
if (report) {
|
|
12039
|
+
report.forEach((item) => {
|
|
12040
|
+
if (item.type == typeStats) {
|
|
12041
|
+
isTargeReportExist[typeStats] = true;
|
|
12042
|
+
}
|
|
12043
|
+
});
|
|
12044
|
+
}
|
|
12045
|
+
});
|
|
12046
|
+
const invalid = Object.keys(isTargeReportExist).findIndex((item) => !isTargeReportExist[item]) >= 0;
|
|
12047
|
+
return report && !invalid ? {
|
|
12022
12048
|
codec: __privateMethod(this, _getLastStatsByType, getLastStatsByType_fn).call(this, report, "codec", {}).now,
|
|
12023
12049
|
rtp: __privateMethod(this, _getLastStatsByType, getLastStatsByType_fn).call(this, report, "inbound-rtp", {
|
|
12024
12050
|
bytesReceived: 0,
|
|
@@ -19234,7 +19260,7 @@ var PuPlayer = (props) => {
|
|
|
19234
19260
|
player.mikeBtn.type = this.protocol;
|
|
19235
19261
|
}
|
|
19236
19262
|
} catch (e) {
|
|
19237
|
-
if (signal.aborted) {
|
|
19263
|
+
if (signal.aborted && e != "protocol == ws-bvrtc" && type != "auto") {
|
|
19238
19264
|
player.mask.visible = true;
|
|
19239
19265
|
player.mask.text = t("connect-failed");
|
|
19240
19266
|
onConnectedFailed && onConnectedFailed();
|
|
@@ -19528,7 +19554,9 @@ var PuPlayer = (props) => {
|
|
|
19528
19554
|
if (this.protocol == protocol)
|
|
19529
19555
|
return;
|
|
19530
19556
|
this.close().then(() => {
|
|
19531
|
-
|
|
19557
|
+
setTimeout(() => {
|
|
19558
|
+
this.open(currentMuted, protocol);
|
|
19559
|
+
}, 500);
|
|
19532
19560
|
});
|
|
19533
19561
|
},
|
|
19534
19562
|
setToken: (newToken) => {
|