@besovideo/webrtc-player 0.8.68 → 0.8.69
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 +117 -18
- package/dist/main.es.js +117 -18
- package/dist/types/api/dialog.d.ts +1 -0
- package/dist/types/utils/media.d.ts +5 -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.8.
|
|
120
|
+
define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.69", PROJECT_NAMESPACE: "bvplayer" };
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
|
|
@@ -5913,7 +5913,7 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
5913
5913
|
fixStack(this);
|
|
5914
5914
|
}
|
|
5915
5915
|
toString() {
|
|
5916
|
-
return `Error: status: ${this.status}, message: ${this.message}
|
|
5916
|
+
return `Error: status: ${this.status}, message: ${this.message}`;
|
|
5917
5917
|
}
|
|
5918
5918
|
};
|
|
5919
5919
|
// 错误码
|
|
@@ -5931,18 +5931,27 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
5931
5931
|
constructor(message) {
|
|
5932
5932
|
super(CustomError.ErrorStatus.OPEN_DIALOG_FAILED, message);
|
|
5933
5933
|
}
|
|
5934
|
+
toString() {
|
|
5935
|
+
return t("da-kai-shi-bai") + "\n" + super.toString();
|
|
5936
|
+
}
|
|
5934
5937
|
};
|
|
5938
|
+
function AppendHost(data) {
|
|
5939
|
+
const hostAppend = {
|
|
5940
|
+
host: apiUrls.bvscpV1().includes("://") ? new URL(apiUrls.bvscpV1()).host : new URL(apiUrls.bvscpV1(), location.origin).host
|
|
5941
|
+
};
|
|
5942
|
+
return __spreadValues(__spreadValues({}, data), hostAppend);
|
|
5943
|
+
}
|
|
5935
5944
|
var DialogIdsKey = core_default.field.createPrefixStorageField("DialogIds");
|
|
5936
5945
|
var getDeviceWebrtc = (param, token, signal) => __async(void 0, null, function* () {
|
|
5937
5946
|
var _a;
|
|
5938
5947
|
const headers = {
|
|
5939
5948
|
Authorization: token || ""
|
|
5940
5949
|
};
|
|
5941
|
-
const params = {
|
|
5950
|
+
const params = AppendHost({
|
|
5942
5951
|
id: param.id,
|
|
5943
5952
|
index: param.index,
|
|
5944
5953
|
sdp: param.sdp
|
|
5945
|
-
};
|
|
5954
|
+
});
|
|
5946
5955
|
const resData = yield http_default.post(
|
|
5947
5956
|
`${apiUrls.bvscpV1()}/dialog/device/webrtc`,
|
|
5948
5957
|
params,
|
|
@@ -5968,11 +5977,11 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
5968
5977
|
const headers = {
|
|
5969
5978
|
Authorization: token || ""
|
|
5970
5979
|
};
|
|
5971
|
-
const params = {
|
|
5980
|
+
const params = AppendHost({
|
|
5972
5981
|
id: param.id,
|
|
5973
5982
|
index: param.index,
|
|
5974
5983
|
sdp: param.sdp
|
|
5975
|
-
};
|
|
5984
|
+
});
|
|
5976
5985
|
const resData = yield http_default.post(
|
|
5977
5986
|
`${apiUrls.bvscpV1()}/dialog/device/bvrtc`,
|
|
5978
5987
|
params,
|
|
@@ -5998,11 +6007,11 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
5998
6007
|
const headers = {
|
|
5999
6008
|
Authorization: token || ""
|
|
6000
6009
|
};
|
|
6001
|
-
const params = {
|
|
6010
|
+
const params = AppendHost({
|
|
6002
6011
|
id: param.id,
|
|
6003
6012
|
index: param.index,
|
|
6004
6013
|
sdp: param.sdp
|
|
6005
|
-
};
|
|
6014
|
+
});
|
|
6006
6015
|
const resData = yield http_default.post(
|
|
6007
6016
|
`${apiUrls.bvscpV1()}/dialog/conference/webrtc`,
|
|
6008
6017
|
params,
|
|
@@ -6025,11 +6034,11 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
6025
6034
|
const headers = {
|
|
6026
6035
|
Authorization: token || ""
|
|
6027
6036
|
};
|
|
6028
|
-
const params = {
|
|
6037
|
+
const params = AppendHost({
|
|
6029
6038
|
id: param.id,
|
|
6030
6039
|
index: param.index,
|
|
6031
6040
|
sdp: param.sdp
|
|
6032
|
-
};
|
|
6041
|
+
});
|
|
6033
6042
|
const resData = yield http_default.post(
|
|
6034
6043
|
`${apiUrls.bvscpV1()}/dialog/conference/bvrtc`,
|
|
6035
6044
|
params,
|
|
@@ -6365,6 +6374,7 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
6365
6374
|
set text(v2) {
|
|
6366
6375
|
this._text = v2;
|
|
6367
6376
|
this._textEl.textContent = v2;
|
|
6377
|
+
this._textEl.style.textAlign = "center";
|
|
6368
6378
|
}
|
|
6369
6379
|
beforeDestroy() {
|
|
6370
6380
|
}
|
|
@@ -6828,13 +6838,66 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
6828
6838
|
}
|
|
6829
6839
|
};
|
|
6830
6840
|
};
|
|
6841
|
+
function webcodecVisiableChangeResumePlay(videoEle) {
|
|
6842
|
+
function isWebcodec() {
|
|
6843
|
+
return videoEle.srcObject instanceof MediaStream && videoEle.srcObject.getTracks().every((item) => item instanceof MediaStreamTrackGenerator);
|
|
6844
|
+
}
|
|
6845
|
+
function HandleEnd() {
|
|
6846
|
+
return __async(this, null, function* () {
|
|
6847
|
+
if (isWebcodec()) {
|
|
6848
|
+
const mediaStream = videoEle.srcObject;
|
|
6849
|
+
yield Promise.allSettled(
|
|
6850
|
+
mediaStream.getTracks().map((item) => {
|
|
6851
|
+
return new Promise((r) => {
|
|
6852
|
+
let intervalToken = setInterval(() => {
|
|
6853
|
+
if (item.readyState == "ended") {
|
|
6854
|
+
clearInterval(intervalToken);
|
|
6855
|
+
r();
|
|
6856
|
+
}
|
|
6857
|
+
}, 500);
|
|
6858
|
+
});
|
|
6859
|
+
})
|
|
6860
|
+
);
|
|
6861
|
+
}
|
|
6862
|
+
});
|
|
6863
|
+
}
|
|
6864
|
+
videoEle.addEventListener("loadedmetadata", () => {
|
|
6865
|
+
function check() {
|
|
6866
|
+
if (isWebcodec()) {
|
|
6867
|
+
if (videoEle.checkVisibility()) {
|
|
6868
|
+
if (intervalToken) {
|
|
6869
|
+
clearInterval(intervalToken);
|
|
6870
|
+
intervalToken = null;
|
|
6871
|
+
}
|
|
6872
|
+
videoEle.play();
|
|
6873
|
+
}
|
|
6874
|
+
}
|
|
6875
|
+
}
|
|
6876
|
+
let intervalToken = null;
|
|
6877
|
+
function RunInterval() {
|
|
6878
|
+
if (isWebcodec() && intervalToken == null) {
|
|
6879
|
+
intervalToken = setInterval(check, 1e3);
|
|
6880
|
+
}
|
|
6881
|
+
}
|
|
6882
|
+
function OnEnd() {
|
|
6883
|
+
if (intervalToken) {
|
|
6884
|
+
clearInterval(intervalToken);
|
|
6885
|
+
intervalToken = null;
|
|
6886
|
+
}
|
|
6887
|
+
videoEle.removeEventListener("pause", RunInterval);
|
|
6888
|
+
}
|
|
6889
|
+
videoEle.addEventListener("pause", RunInterval);
|
|
6890
|
+
HandleEnd().then(OnEnd);
|
|
6891
|
+
});
|
|
6892
|
+
}
|
|
6831
6893
|
var media = {
|
|
6832
6894
|
canvasToBlob,
|
|
6833
6895
|
screenshotByCanvas,
|
|
6834
6896
|
screenshot,
|
|
6835
6897
|
record,
|
|
6836
6898
|
getMediaDir,
|
|
6837
|
-
video2Canvas
|
|
6899
|
+
video2Canvas,
|
|
6900
|
+
webcodecVisiableChangeResumePlay
|
|
6838
6901
|
};
|
|
6839
6902
|
var media_default = media;
|
|
6840
6903
|
|
|
@@ -6985,6 +7048,9 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
|
|
|
6985
7048
|
}
|
|
6986
7049
|
this._canvasEl = newEl;
|
|
6987
7050
|
this._mediaStream = null;
|
|
7051
|
+
if (newEl.tagName == "VIDEO") {
|
|
7052
|
+
media_default.webcodecVisiableChangeResumePlay(newEl);
|
|
7053
|
+
}
|
|
6988
7054
|
}
|
|
6989
7055
|
setCaptureProvider(capture) {
|
|
6990
7056
|
this._captureStream = capture;
|
|
@@ -8398,6 +8464,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
8398
8464
|
const {
|
|
8399
8465
|
offerParam,
|
|
8400
8466
|
productRemoteSdp,
|
|
8467
|
+
closeDialog: closeDialog2,
|
|
8401
8468
|
customerRTCPeerConnection,
|
|
8402
8469
|
onConnected,
|
|
8403
8470
|
onConnectedFailed,
|
|
@@ -8417,7 +8484,17 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
8417
8484
|
"connectionstatechange",
|
|
8418
8485
|
(e) => onConnectionStateChange(pc, e)
|
|
8419
8486
|
);
|
|
8420
|
-
|
|
8487
|
+
let trackEvent = null;
|
|
8488
|
+
const invokeTrack = (e) => {
|
|
8489
|
+
if (e) {
|
|
8490
|
+
trackEvent = e;
|
|
8491
|
+
}
|
|
8492
|
+
if (pc.connectionState == "connected" && trackEvent) {
|
|
8493
|
+
gotRemoteStream(pc, trackEvent, onGotStream);
|
|
8494
|
+
trackEvent = null;
|
|
8495
|
+
}
|
|
8496
|
+
};
|
|
8497
|
+
pc.addEventListener("track", (e) => invokeTrack(e));
|
|
8421
8498
|
onPcEventAdded && (yield onPcEventAdded(pc));
|
|
8422
8499
|
if (isCustomerPc) {
|
|
8423
8500
|
return new WebRTCConnect(pc);
|
|
@@ -8433,7 +8510,8 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
8433
8510
|
logger_default.info("\u521B\u5EFAoffer\uFF0C\u53C2\u6570\uFF1A", offerParam, "\uFF0C \u7ED3\u679C\uFF1A", offer);
|
|
8434
8511
|
yield pc.setLocalDescription(offer);
|
|
8435
8512
|
onLocalDescriptionReady && onLocalDescriptionReady(pc);
|
|
8436
|
-
|
|
8513
|
+
let remoteSdp = "";
|
|
8514
|
+
remoteSdp = yield productRemoteSdp(new RTCSessionDescription(offer));
|
|
8437
8515
|
logger_default.info("webrtc remoteSDP: ", remoteSdp);
|
|
8438
8516
|
if (/a=rtpmap:\d+ H265/gi.test(remoteSdp || "")) {
|
|
8439
8517
|
throw new WebrtcH265Error(
|
|
@@ -8446,6 +8524,22 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
8446
8524
|
});
|
|
8447
8525
|
yield pc.setRemoteDescription(remoteDescription);
|
|
8448
8526
|
logger_default.debug("getTransceivers", pc.getTransceivers());
|
|
8527
|
+
yield new Promise((r, j) => {
|
|
8528
|
+
let iCount = 1;
|
|
8529
|
+
const intervalToken = setInterval(() => {
|
|
8530
|
+
if (pc.connectionState == "connected") {
|
|
8531
|
+
invokeTrack();
|
|
8532
|
+
r();
|
|
8533
|
+
} else if (iCount > 500) {
|
|
8534
|
+
closeDialog2 && closeDialog2();
|
|
8535
|
+
j(t("connect-failed"));
|
|
8536
|
+
} else {
|
|
8537
|
+
iCount++;
|
|
8538
|
+
return;
|
|
8539
|
+
}
|
|
8540
|
+
clearInterval(intervalToken);
|
|
8541
|
+
}, 20);
|
|
8542
|
+
});
|
|
8449
8543
|
onConnected && onConnected(pc);
|
|
8450
8544
|
} catch (e) {
|
|
8451
8545
|
onConnectedFailed && onConnectedFailed(pc);
|
|
@@ -14201,7 +14295,8 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
14201
14295
|
transfer: "transfer",
|
|
14202
14296
|
type: "type",
|
|
14203
14297
|
"yu-zhi-dian": "preset",
|
|
14204
|
-
"mei-you-mai-ke-feng-huo-zhe-mei-you-quan-xian": "Mic not found or permission deny"
|
|
14298
|
+
"mei-you-mai-ke-feng-huo-zhe-mei-you-quan-xian": "Mic not found or permission deny",
|
|
14299
|
+
"da-kai-shi-bai": "open fail"
|
|
14205
14300
|
};
|
|
14206
14301
|
|
|
14207
14302
|
// src/locales/zh.json
|
|
@@ -14241,7 +14336,8 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
14241
14336
|
transfer: "\u4F20\u8F93",
|
|
14242
14337
|
type: "\u65B9\u5F0F",
|
|
14243
14338
|
"yu-zhi-dian": "\u9884\u5236\u70B9",
|
|
14244
|
-
"mei-you-mai-ke-feng-huo-zhe-mei-you-quan-xian": "\u6CA1\u6709\u9EA6\u514B\u98CE\uFF0C\u6216\u8005\u6CA1\u6709\u6743\u9650"
|
|
14339
|
+
"mei-you-mai-ke-feng-huo-zhe-mei-you-quan-xian": "\u6CA1\u6709\u9EA6\u514B\u98CE\uFF0C\u6216\u8005\u6CA1\u6709\u6743\u9650",
|
|
14340
|
+
"da-kai-shi-bai": "\u6253\u5F00\u5931\u8D25"
|
|
14245
14341
|
};
|
|
14246
14342
|
|
|
14247
14343
|
// src/locales/i18n.ts
|
|
@@ -15511,6 +15607,9 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
15511
15607
|
);
|
|
15512
15608
|
return product(localDescription);
|
|
15513
15609
|
}),
|
|
15610
|
+
closeDialog() {
|
|
15611
|
+
handleClose();
|
|
15612
|
+
},
|
|
15514
15613
|
onIceDisconnected: () => {
|
|
15515
15614
|
player.mask.visible = true;
|
|
15516
15615
|
player.mask.text = t("lost-connection");
|
|
@@ -15621,9 +15720,9 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
15621
15720
|
player.mikeBtn.type = this.protocol;
|
|
15622
15721
|
}
|
|
15623
15722
|
} catch (e) {
|
|
15624
|
-
if (
|
|
15723
|
+
if (type == "webrtc") {
|
|
15625
15724
|
player.mask.visible = true;
|
|
15626
|
-
player.mask.text =
|
|
15725
|
+
player.mask.text = e.toString();
|
|
15627
15726
|
onConnectedFailed && onConnectedFailed();
|
|
15628
15727
|
useRecntMgr == null ? void 0 : useRecntMgr.reconnect();
|
|
15629
15728
|
return;
|
|
@@ -15842,7 +15941,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
|
|
|
15842
15941
|
}
|
|
15843
15942
|
} catch (e2) {
|
|
15844
15943
|
player.mask.visible = true;
|
|
15845
|
-
player.mask.text =
|
|
15944
|
+
player.mask.text = e2.toString();
|
|
15846
15945
|
hplayer == null ? void 0 : hplayer.close();
|
|
15847
15946
|
onConnectedFailed && onConnectedFailed();
|
|
15848
15947
|
useRecntMgr == null ? void 0 : useRecntMgr.reconnect();
|
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.69", PROJECT_NAMESPACE: "bvplayer" };
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
|
|
@@ -5899,7 +5899,7 @@ var CustomError = class extends Error {
|
|
|
5899
5899
|
fixStack(this);
|
|
5900
5900
|
}
|
|
5901
5901
|
toString() {
|
|
5902
|
-
return `Error: status: ${this.status}, message: ${this.message}
|
|
5902
|
+
return `Error: status: ${this.status}, message: ${this.message}`;
|
|
5903
5903
|
}
|
|
5904
5904
|
};
|
|
5905
5905
|
// 错误码
|
|
@@ -5917,18 +5917,27 @@ var OpenDialogError = class extends CustomError {
|
|
|
5917
5917
|
constructor(message) {
|
|
5918
5918
|
super(CustomError.ErrorStatus.OPEN_DIALOG_FAILED, message);
|
|
5919
5919
|
}
|
|
5920
|
+
toString() {
|
|
5921
|
+
return t("da-kai-shi-bai") + "\n" + super.toString();
|
|
5922
|
+
}
|
|
5920
5923
|
};
|
|
5924
|
+
function AppendHost(data) {
|
|
5925
|
+
const hostAppend = {
|
|
5926
|
+
host: apiUrls.bvscpV1().includes("://") ? new URL(apiUrls.bvscpV1()).host : new URL(apiUrls.bvscpV1(), location.origin).host
|
|
5927
|
+
};
|
|
5928
|
+
return __spreadValues(__spreadValues({}, data), hostAppend);
|
|
5929
|
+
}
|
|
5921
5930
|
var DialogIdsKey = core_default.field.createPrefixStorageField("DialogIds");
|
|
5922
5931
|
var getDeviceWebrtc = (param, token, signal) => __async(void 0, null, function* () {
|
|
5923
5932
|
var _a;
|
|
5924
5933
|
const headers = {
|
|
5925
5934
|
Authorization: token || ""
|
|
5926
5935
|
};
|
|
5927
|
-
const params = {
|
|
5936
|
+
const params = AppendHost({
|
|
5928
5937
|
id: param.id,
|
|
5929
5938
|
index: param.index,
|
|
5930
5939
|
sdp: param.sdp
|
|
5931
|
-
};
|
|
5940
|
+
});
|
|
5932
5941
|
const resData = yield http_default.post(
|
|
5933
5942
|
`${apiUrls.bvscpV1()}/dialog/device/webrtc`,
|
|
5934
5943
|
params,
|
|
@@ -5954,11 +5963,11 @@ var getDeviceBvrtc = (param, token, signal) => __async(void 0, null, function* (
|
|
|
5954
5963
|
const headers = {
|
|
5955
5964
|
Authorization: token || ""
|
|
5956
5965
|
};
|
|
5957
|
-
const params = {
|
|
5966
|
+
const params = AppendHost({
|
|
5958
5967
|
id: param.id,
|
|
5959
5968
|
index: param.index,
|
|
5960
5969
|
sdp: param.sdp
|
|
5961
|
-
};
|
|
5970
|
+
});
|
|
5962
5971
|
const resData = yield http_default.post(
|
|
5963
5972
|
`${apiUrls.bvscpV1()}/dialog/device/bvrtc`,
|
|
5964
5973
|
params,
|
|
@@ -5984,11 +5993,11 @@ var getConferenceWebrtc = (param, token) => __async(void 0, null, function* () {
|
|
|
5984
5993
|
const headers = {
|
|
5985
5994
|
Authorization: token || ""
|
|
5986
5995
|
};
|
|
5987
|
-
const params = {
|
|
5996
|
+
const params = AppendHost({
|
|
5988
5997
|
id: param.id,
|
|
5989
5998
|
index: param.index,
|
|
5990
5999
|
sdp: param.sdp
|
|
5991
|
-
};
|
|
6000
|
+
});
|
|
5992
6001
|
const resData = yield http_default.post(
|
|
5993
6002
|
`${apiUrls.bvscpV1()}/dialog/conference/webrtc`,
|
|
5994
6003
|
params,
|
|
@@ -6011,11 +6020,11 @@ var getConferenceBvrtc = (param, token) => __async(void 0, null, function* () {
|
|
|
6011
6020
|
const headers = {
|
|
6012
6021
|
Authorization: token || ""
|
|
6013
6022
|
};
|
|
6014
|
-
const params = {
|
|
6023
|
+
const params = AppendHost({
|
|
6015
6024
|
id: param.id,
|
|
6016
6025
|
index: param.index,
|
|
6017
6026
|
sdp: param.sdp
|
|
6018
|
-
};
|
|
6027
|
+
});
|
|
6019
6028
|
const resData = yield http_default.post(
|
|
6020
6029
|
`${apiUrls.bvscpV1()}/dialog/conference/bvrtc`,
|
|
6021
6030
|
params,
|
|
@@ -6351,6 +6360,7 @@ var MaskPlugin = class extends Plugin {
|
|
|
6351
6360
|
set text(v2) {
|
|
6352
6361
|
this._text = v2;
|
|
6353
6362
|
this._textEl.textContent = v2;
|
|
6363
|
+
this._textEl.style.textAlign = "center";
|
|
6354
6364
|
}
|
|
6355
6365
|
beforeDestroy() {
|
|
6356
6366
|
}
|
|
@@ -6814,13 +6824,66 @@ var video2Canvas = (video, opts) => {
|
|
|
6814
6824
|
}
|
|
6815
6825
|
};
|
|
6816
6826
|
};
|
|
6827
|
+
function webcodecVisiableChangeResumePlay(videoEle) {
|
|
6828
|
+
function isWebcodec() {
|
|
6829
|
+
return videoEle.srcObject instanceof MediaStream && videoEle.srcObject.getTracks().every((item) => item instanceof MediaStreamTrackGenerator);
|
|
6830
|
+
}
|
|
6831
|
+
function HandleEnd() {
|
|
6832
|
+
return __async(this, null, function* () {
|
|
6833
|
+
if (isWebcodec()) {
|
|
6834
|
+
const mediaStream = videoEle.srcObject;
|
|
6835
|
+
yield Promise.allSettled(
|
|
6836
|
+
mediaStream.getTracks().map((item) => {
|
|
6837
|
+
return new Promise((r) => {
|
|
6838
|
+
let intervalToken = setInterval(() => {
|
|
6839
|
+
if (item.readyState == "ended") {
|
|
6840
|
+
clearInterval(intervalToken);
|
|
6841
|
+
r();
|
|
6842
|
+
}
|
|
6843
|
+
}, 500);
|
|
6844
|
+
});
|
|
6845
|
+
})
|
|
6846
|
+
);
|
|
6847
|
+
}
|
|
6848
|
+
});
|
|
6849
|
+
}
|
|
6850
|
+
videoEle.addEventListener("loadedmetadata", () => {
|
|
6851
|
+
function check() {
|
|
6852
|
+
if (isWebcodec()) {
|
|
6853
|
+
if (videoEle.checkVisibility()) {
|
|
6854
|
+
if (intervalToken) {
|
|
6855
|
+
clearInterval(intervalToken);
|
|
6856
|
+
intervalToken = null;
|
|
6857
|
+
}
|
|
6858
|
+
videoEle.play();
|
|
6859
|
+
}
|
|
6860
|
+
}
|
|
6861
|
+
}
|
|
6862
|
+
let intervalToken = null;
|
|
6863
|
+
function RunInterval() {
|
|
6864
|
+
if (isWebcodec() && intervalToken == null) {
|
|
6865
|
+
intervalToken = setInterval(check, 1e3);
|
|
6866
|
+
}
|
|
6867
|
+
}
|
|
6868
|
+
function OnEnd() {
|
|
6869
|
+
if (intervalToken) {
|
|
6870
|
+
clearInterval(intervalToken);
|
|
6871
|
+
intervalToken = null;
|
|
6872
|
+
}
|
|
6873
|
+
videoEle.removeEventListener("pause", RunInterval);
|
|
6874
|
+
}
|
|
6875
|
+
videoEle.addEventListener("pause", RunInterval);
|
|
6876
|
+
HandleEnd().then(OnEnd);
|
|
6877
|
+
});
|
|
6878
|
+
}
|
|
6817
6879
|
var media = {
|
|
6818
6880
|
canvasToBlob,
|
|
6819
6881
|
screenshotByCanvas,
|
|
6820
6882
|
screenshot,
|
|
6821
6883
|
record,
|
|
6822
6884
|
getMediaDir,
|
|
6823
|
-
video2Canvas
|
|
6885
|
+
video2Canvas,
|
|
6886
|
+
webcodecVisiableChangeResumePlay
|
|
6824
6887
|
};
|
|
6825
6888
|
var media_default = media;
|
|
6826
6889
|
|
|
@@ -6971,6 +7034,9 @@ var VideoPlugin = class extends Plugin {
|
|
|
6971
7034
|
}
|
|
6972
7035
|
this._canvasEl = newEl;
|
|
6973
7036
|
this._mediaStream = null;
|
|
7037
|
+
if (newEl.tagName == "VIDEO") {
|
|
7038
|
+
media_default.webcodecVisiableChangeResumePlay(newEl);
|
|
7039
|
+
}
|
|
6974
7040
|
}
|
|
6975
7041
|
setCaptureProvider(capture) {
|
|
6976
7042
|
this._captureStream = capture;
|
|
@@ -8384,6 +8450,7 @@ var connect = (param, onGotStream) => __async(void 0, null, function* () {
|
|
|
8384
8450
|
const {
|
|
8385
8451
|
offerParam,
|
|
8386
8452
|
productRemoteSdp,
|
|
8453
|
+
closeDialog: closeDialog2,
|
|
8387
8454
|
customerRTCPeerConnection,
|
|
8388
8455
|
onConnected,
|
|
8389
8456
|
onConnectedFailed,
|
|
@@ -8403,7 +8470,17 @@ var connect = (param, onGotStream) => __async(void 0, null, function* () {
|
|
|
8403
8470
|
"connectionstatechange",
|
|
8404
8471
|
(e) => onConnectionStateChange(pc, e)
|
|
8405
8472
|
);
|
|
8406
|
-
|
|
8473
|
+
let trackEvent = null;
|
|
8474
|
+
const invokeTrack = (e) => {
|
|
8475
|
+
if (e) {
|
|
8476
|
+
trackEvent = e;
|
|
8477
|
+
}
|
|
8478
|
+
if (pc.connectionState == "connected" && trackEvent) {
|
|
8479
|
+
gotRemoteStream(pc, trackEvent, onGotStream);
|
|
8480
|
+
trackEvent = null;
|
|
8481
|
+
}
|
|
8482
|
+
};
|
|
8483
|
+
pc.addEventListener("track", (e) => invokeTrack(e));
|
|
8407
8484
|
onPcEventAdded && (yield onPcEventAdded(pc));
|
|
8408
8485
|
if (isCustomerPc) {
|
|
8409
8486
|
return new WebRTCConnect(pc);
|
|
@@ -8419,7 +8496,8 @@ var connect = (param, onGotStream) => __async(void 0, null, function* () {
|
|
|
8419
8496
|
logger_default.info("\u521B\u5EFAoffer\uFF0C\u53C2\u6570\uFF1A", offerParam, "\uFF0C \u7ED3\u679C\uFF1A", offer);
|
|
8420
8497
|
yield pc.setLocalDescription(offer);
|
|
8421
8498
|
onLocalDescriptionReady && onLocalDescriptionReady(pc);
|
|
8422
|
-
|
|
8499
|
+
let remoteSdp = "";
|
|
8500
|
+
remoteSdp = yield productRemoteSdp(new RTCSessionDescription(offer));
|
|
8423
8501
|
logger_default.info("webrtc remoteSDP: ", remoteSdp);
|
|
8424
8502
|
if (/a=rtpmap:\d+ H265/gi.test(remoteSdp || "")) {
|
|
8425
8503
|
throw new WebrtcH265Error(
|
|
@@ -8432,6 +8510,22 @@ var connect = (param, onGotStream) => __async(void 0, null, function* () {
|
|
|
8432
8510
|
});
|
|
8433
8511
|
yield pc.setRemoteDescription(remoteDescription);
|
|
8434
8512
|
logger_default.debug("getTransceivers", pc.getTransceivers());
|
|
8513
|
+
yield new Promise((r, j) => {
|
|
8514
|
+
let iCount = 1;
|
|
8515
|
+
const intervalToken = setInterval(() => {
|
|
8516
|
+
if (pc.connectionState == "connected") {
|
|
8517
|
+
invokeTrack();
|
|
8518
|
+
r();
|
|
8519
|
+
} else if (iCount > 500) {
|
|
8520
|
+
closeDialog2 && closeDialog2();
|
|
8521
|
+
j(t("connect-failed"));
|
|
8522
|
+
} else {
|
|
8523
|
+
iCount++;
|
|
8524
|
+
return;
|
|
8525
|
+
}
|
|
8526
|
+
clearInterval(intervalToken);
|
|
8527
|
+
}, 20);
|
|
8528
|
+
});
|
|
8435
8529
|
onConnected && onConnected(pc);
|
|
8436
8530
|
} catch (e) {
|
|
8437
8531
|
onConnectedFailed && onConnectedFailed(pc);
|
|
@@ -14187,7 +14281,8 @@ var en_default = {
|
|
|
14187
14281
|
transfer: "transfer",
|
|
14188
14282
|
type: "type",
|
|
14189
14283
|
"yu-zhi-dian": "preset",
|
|
14190
|
-
"mei-you-mai-ke-feng-huo-zhe-mei-you-quan-xian": "Mic not found or permission deny"
|
|
14284
|
+
"mei-you-mai-ke-feng-huo-zhe-mei-you-quan-xian": "Mic not found or permission deny",
|
|
14285
|
+
"da-kai-shi-bai": "open fail"
|
|
14191
14286
|
};
|
|
14192
14287
|
|
|
14193
14288
|
// src/locales/zh.json
|
|
@@ -14227,7 +14322,8 @@ var zh_default = {
|
|
|
14227
14322
|
transfer: "\u4F20\u8F93",
|
|
14228
14323
|
type: "\u65B9\u5F0F",
|
|
14229
14324
|
"yu-zhi-dian": "\u9884\u5236\u70B9",
|
|
14230
|
-
"mei-you-mai-ke-feng-huo-zhe-mei-you-quan-xian": "\u6CA1\u6709\u9EA6\u514B\u98CE\uFF0C\u6216\u8005\u6CA1\u6709\u6743\u9650"
|
|
14325
|
+
"mei-you-mai-ke-feng-huo-zhe-mei-you-quan-xian": "\u6CA1\u6709\u9EA6\u514B\u98CE\uFF0C\u6216\u8005\u6CA1\u6709\u6743\u9650",
|
|
14326
|
+
"da-kai-shi-bai": "\u6253\u5F00\u5931\u8D25"
|
|
14231
14327
|
};
|
|
14232
14328
|
|
|
14233
14329
|
// src/locales/i18n.ts
|
|
@@ -15497,6 +15593,9 @@ var PuPlayer = (props) => {
|
|
|
15497
15593
|
);
|
|
15498
15594
|
return product(localDescription);
|
|
15499
15595
|
}),
|
|
15596
|
+
closeDialog() {
|
|
15597
|
+
handleClose();
|
|
15598
|
+
},
|
|
15500
15599
|
onIceDisconnected: () => {
|
|
15501
15600
|
player.mask.visible = true;
|
|
15502
15601
|
player.mask.text = t("lost-connection");
|
|
@@ -15607,9 +15706,9 @@ var PuPlayer = (props) => {
|
|
|
15607
15706
|
player.mikeBtn.type = this.protocol;
|
|
15608
15707
|
}
|
|
15609
15708
|
} catch (e) {
|
|
15610
|
-
if (
|
|
15709
|
+
if (type == "webrtc") {
|
|
15611
15710
|
player.mask.visible = true;
|
|
15612
|
-
player.mask.text =
|
|
15711
|
+
player.mask.text = e.toString();
|
|
15613
15712
|
onConnectedFailed && onConnectedFailed();
|
|
15614
15713
|
useRecntMgr == null ? void 0 : useRecntMgr.reconnect();
|
|
15615
15714
|
return;
|
|
@@ -15828,7 +15927,7 @@ var PuPlayer = (props) => {
|
|
|
15828
15927
|
}
|
|
15829
15928
|
} catch (e2) {
|
|
15830
15929
|
player.mask.visible = true;
|
|
15831
|
-
player.mask.text =
|
|
15930
|
+
player.mask.text = e2.toString();
|
|
15832
15931
|
hplayer == null ? void 0 : hplayer.close();
|
|
15833
15932
|
onConnectedFailed && onConnectedFailed();
|
|
15834
15933
|
useRecntMgr == null ? void 0 : useRecntMgr.reconnect();
|
|
@@ -27,6 +27,10 @@ export declare class VideoProcessor {
|
|
|
27
27
|
extractPixels(): Uint8Array;
|
|
28
28
|
private setupCanvas;
|
|
29
29
|
}
|
|
30
|
+
declare global {
|
|
31
|
+
const MediaStreamTrackGenerator: any;
|
|
32
|
+
}
|
|
33
|
+
declare function webcodecVisiableChangeResumePlay(videoEle: HTMLVideoElement): void;
|
|
30
34
|
declare const media: {
|
|
31
35
|
canvasToBlob: (canvas: HTMLCanvasElement) => Promise<Blob | null>;
|
|
32
36
|
screenshotByCanvas: (canvas?: HTMLCanvasElement | null | undefined, fileName?: string) => Promise<void>;
|
|
@@ -34,5 +38,6 @@ declare const media: {
|
|
|
34
38
|
record: (element: IStreamProvider, stream?: MediaStream | null | undefined, fileName?: string) => [MediaRecorder?, MediaStream?];
|
|
35
39
|
getMediaDir: (option: IMediaOption) => number;
|
|
36
40
|
video2Canvas: (video: HTMLVideoElement, opts: IVideo2CanvasOptions) => ICanvasControl;
|
|
41
|
+
webcodecVisiableChangeResumePlay: typeof webcodecVisiableChangeResumePlay;
|
|
37
42
|
};
|
|
38
43
|
export default media;
|