@volcengine/veplayer 2.12.1 → 2.13.1-rc.0
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/esm/veplayer.biz.live.development.js +156 -8
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +86 -4
- package/esm/veplayer.development.js +157 -9
- package/esm/veplayer.live.d.ts +86 -4
- package/esm/veplayer.live.development.js +157 -9
- package/esm/veplayer.live.production.js +3 -3
- package/esm/veplayer.production.js +3 -3
- package/esm/veplayer.vod.development.js +1 -1
- package/esm/veplayer.vod.production.js +1 -1
- package/package.json +1 -1
- package/umd/veplayer.biz.live.development.js +156 -8
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +86 -4
- package/umd/veplayer.development.js +157 -9
- package/umd/veplayer.live.d.ts +86 -4
- package/umd/veplayer.live.development.js +157 -9
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.development.js +1 -1
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +86 -4
- package/veplayer.live.d.ts +86 -4
|
@@ -26719,7 +26719,7 @@ let Logger$1 = class Logger2 extends Plugin$2 {
|
|
|
26719
26719
|
device_id: deviceId,
|
|
26720
26720
|
error_report_stop: true,
|
|
26721
26721
|
ext: {
|
|
26722
|
-
veplayer_version: "2.3.
|
|
26722
|
+
veplayer_version: "2.3.1-rc.1",
|
|
26723
26723
|
flv_version: "3.0.24-rc.6",
|
|
26724
26724
|
hls_version: "3.0.24-rc.2",
|
|
26725
26725
|
rts_version: "0.2.1-alpha.64"
|
|
@@ -26733,7 +26733,6 @@ function normalizeNumber(value, transform) {
|
|
|
26733
26733
|
return transform ? transform(value) : value.toString();
|
|
26734
26734
|
}
|
|
26735
26735
|
function getDefaultRow(data2) {
|
|
26736
|
-
var _a;
|
|
26737
26736
|
return {
|
|
26738
26737
|
rows: [
|
|
26739
26738
|
{
|
|
@@ -26774,7 +26773,10 @@ function getDefaultRow(data2) {
|
|
|
26774
26773
|
{
|
|
26775
26774
|
key: "bufferEnd",
|
|
26776
26775
|
labelTextKey: "BUFFER_END",
|
|
26777
|
-
value: normalizeNumber(
|
|
26776
|
+
value: normalizeNumber(
|
|
26777
|
+
data2.bufferEnd,
|
|
26778
|
+
(value) => Number(value.toFixed(2)).toString()
|
|
26779
|
+
)
|
|
26778
26780
|
},
|
|
26779
26781
|
{
|
|
26780
26782
|
key: "currentTime",
|
|
@@ -51015,6 +51017,79 @@ class LiveVeStrategy {
|
|
|
51015
51017
|
}
|
|
51016
51018
|
}
|
|
51017
51019
|
const liveVeStrategy = new LiveVeStrategy();
|
|
51020
|
+
const isNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
51021
|
+
const getTimestamp = (delaySEI, currentKey, legacyKey) => {
|
|
51022
|
+
const currentValue = delaySEI[currentKey];
|
|
51023
|
+
if (isNumber(currentValue)) {
|
|
51024
|
+
return currentValue;
|
|
51025
|
+
}
|
|
51026
|
+
const legacyValue = delaySEI[legacyKey];
|
|
51027
|
+
return isNumber(legacyValue) ? legacyValue : void 0;
|
|
51028
|
+
};
|
|
51029
|
+
const utf8ArrayToString = (array) => {
|
|
51030
|
+
let result = "";
|
|
51031
|
+
let index = 0;
|
|
51032
|
+
while (index < array.length) {
|
|
51033
|
+
const first = array[index++];
|
|
51034
|
+
if (first < 128) {
|
|
51035
|
+
result += String.fromCharCode(first);
|
|
51036
|
+
} else if (first < 224) {
|
|
51037
|
+
const second = array[index++];
|
|
51038
|
+
result += String.fromCharCode((first & 31) << 6 | second & 63);
|
|
51039
|
+
} else {
|
|
51040
|
+
const second = array[index++];
|
|
51041
|
+
const third = array[index++];
|
|
51042
|
+
result += String.fromCharCode(
|
|
51043
|
+
(first & 15) << 12 | (second & 63) << 6 | third & 63
|
|
51044
|
+
);
|
|
51045
|
+
}
|
|
51046
|
+
}
|
|
51047
|
+
return result;
|
|
51048
|
+
};
|
|
51049
|
+
const getSEIDelayStats = (sei, bufferTime = 0, now3 = Date.now()) => {
|
|
51050
|
+
if ((sei == null ? void 0 : sei.code) !== 100 || !sei.content) {
|
|
51051
|
+
return;
|
|
51052
|
+
}
|
|
51053
|
+
try {
|
|
51054
|
+
const rawSEI = utf8ArrayToString(sei.content);
|
|
51055
|
+
const jsonStart = rawSEI.indexOf("{");
|
|
51056
|
+
const jsonEnd = rawSEI.lastIndexOf("}");
|
|
51057
|
+
if (jsonStart < 0 || jsonEnd < jsonStart) {
|
|
51058
|
+
return;
|
|
51059
|
+
}
|
|
51060
|
+
const seiContent = JSON.parse(rawSEI.slice(jsonStart, jsonEnd + 1));
|
|
51061
|
+
const delaySEI = seiContent == null ? void 0 : seiContent.video_e2e_delay;
|
|
51062
|
+
if (!delaySEI || typeof delaySEI !== "object") {
|
|
51063
|
+
return;
|
|
51064
|
+
}
|
|
51065
|
+
const push3 = getTimestamp(delaySEI, "push_edge_ts", "push_node");
|
|
51066
|
+
const source = getTimestamp(delaySEI, "source_ts", "source_node");
|
|
51067
|
+
const cmafSource = getTimestamp(
|
|
51068
|
+
delaySEI,
|
|
51069
|
+
"cmaf_source_ts",
|
|
51070
|
+
"cmaf_source_node"
|
|
51071
|
+
);
|
|
51072
|
+
const hlsSource = getTimestamp(
|
|
51073
|
+
delaySEI,
|
|
51074
|
+
"hls_source_ts",
|
|
51075
|
+
"hls_source_node"
|
|
51076
|
+
);
|
|
51077
|
+
const pull = getTimestamp(delaySEI, "pull_edge_ts", "pull_node");
|
|
51078
|
+
const start = push3 ?? source;
|
|
51079
|
+
const end = pull ?? hlsSource ?? cmafSource;
|
|
51080
|
+
if (!isNumber(start) || !isNumber(end)) {
|
|
51081
|
+
return;
|
|
51082
|
+
}
|
|
51083
|
+
const delayS2S = end - start;
|
|
51084
|
+
const safeBufferTime = isNumber(bufferTime) ? Math.max(0, bufferTime) : 0;
|
|
51085
|
+
return {
|
|
51086
|
+
delay_s2s: delayS2S,
|
|
51087
|
+
delay_s2e: delayS2S + Math.max(0, now3 - end) + safeBufferTime
|
|
51088
|
+
};
|
|
51089
|
+
} catch (e2) {
|
|
51090
|
+
return;
|
|
51091
|
+
}
|
|
51092
|
+
};
|
|
51018
51093
|
const DEFAULT_PLUGINS = window["VePlayer"].DEFAULT_PLUGINS;
|
|
51019
51094
|
const VePlayerBase = window["VePlayer"].VePlayerBase;
|
|
51020
51095
|
const VeI18n = window["VePlayer"].VeI18n;
|
|
@@ -51057,6 +51132,22 @@ class VePlayerLive extends VePlayerBase {
|
|
|
51057
51132
|
* @hidden
|
|
51058
51133
|
*/
|
|
51059
51134
|
__publicField(this, "_protocolManager");
|
|
51135
|
+
__publicField(this, "_seiDelayStats", {});
|
|
51136
|
+
__publicField(this, "_resetSEIDelayStats", () => {
|
|
51137
|
+
this._seiDelayStats = {};
|
|
51138
|
+
});
|
|
51139
|
+
__publicField(this, "_handleSEI", (data2) => {
|
|
51140
|
+
const stats = getSEIDelayStats(data2 == null ? void 0 : data2.sei, this._getPlayerBufferTime());
|
|
51141
|
+
if (stats) {
|
|
51142
|
+
this._seiDelayStats = stats;
|
|
51143
|
+
}
|
|
51144
|
+
});
|
|
51145
|
+
this.on(Events$1.SEI, this._handleSEI);
|
|
51146
|
+
this.on(Events$1.URL_CHANGE, this._resetSEIDelayStats);
|
|
51147
|
+
this.on(Events$1.SOURCE_CHANGE, this._resetSEIDelayStats);
|
|
51148
|
+
this.on(Events$1.DEFINITION_CHANGE, this._resetSEIDelayStats);
|
|
51149
|
+
this.on(Events$1.REPLAY, this._resetSEIDelayStats);
|
|
51150
|
+
this.on(Events$1.FALLBACK, this._resetSEIDelayStats);
|
|
51060
51151
|
}
|
|
51061
51152
|
/** {zh}
|
|
51062
51153
|
* @brief 获取已经播放的时长,不包含暂停和等待时间,单位为秒。
|
|
@@ -51098,6 +51189,22 @@ class VePlayerLive extends VePlayerBase {
|
|
|
51098
51189
|
var _a, _b;
|
|
51099
51190
|
return (_b = (_a = this._player.plugins) == null ? void 0 : _a.hls) == null ? void 0 : _b.hls;
|
|
51100
51191
|
}
|
|
51192
|
+
/** {zh}
|
|
51193
|
+
* @hidden
|
|
51194
|
+
*/
|
|
51195
|
+
/** {en}
|
|
51196
|
+
* @hidden
|
|
51197
|
+
*/
|
|
51198
|
+
destroy() {
|
|
51199
|
+
this.off(Events$1.SEI, this._handleSEI);
|
|
51200
|
+
this.off(Events$1.URL_CHANGE, this._resetSEIDelayStats);
|
|
51201
|
+
this.off(Events$1.SOURCE_CHANGE, this._resetSEIDelayStats);
|
|
51202
|
+
this.off(Events$1.DEFINITION_CHANGE, this._resetSEIDelayStats);
|
|
51203
|
+
this.off(Events$1.REPLAY, this._resetSEIDelayStats);
|
|
51204
|
+
this.off(Events$1.FALLBACK, this._resetSEIDelayStats);
|
|
51205
|
+
this._resetSEIDelayStats();
|
|
51206
|
+
super.destroy();
|
|
51207
|
+
}
|
|
51101
51208
|
/** {zh}
|
|
51102
51209
|
* @brief 调用此方法开启直播日志上报。
|
|
51103
51210
|
*/
|
|
@@ -51234,7 +51341,8 @@ class VePlayerLive extends VePlayerBase {
|
|
|
51234
51341
|
*/
|
|
51235
51342
|
async getRTMStats() {
|
|
51236
51343
|
var _a, _b, _c;
|
|
51237
|
-
|
|
51344
|
+
const stats = await ((_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getStatsSnapshoot());
|
|
51345
|
+
return this._mergeSEIDelayStats(stats);
|
|
51238
51346
|
}
|
|
51239
51347
|
/** {zh}
|
|
51240
51348
|
* @brief 获取 FLV 拉流的播放信息。
|
|
@@ -51245,7 +51353,8 @@ class VePlayerLive extends VePlayerBase {
|
|
|
51245
51353
|
*/
|
|
51246
51354
|
getFLVStats() {
|
|
51247
51355
|
var _a, _b, _c;
|
|
51248
|
-
|
|
51356
|
+
const stats = (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.flv) == null ? void 0 : _c.getStats();
|
|
51357
|
+
return this._mergeSEIDelayStats(stats);
|
|
51249
51358
|
}
|
|
51250
51359
|
/** {zh}
|
|
51251
51360
|
* @brief 获取 HLS 拉流的播放信息。
|
|
@@ -51257,8 +51366,9 @@ class VePlayerLive extends VePlayerBase {
|
|
|
51257
51366
|
* @hidden
|
|
51258
51367
|
*/
|
|
51259
51368
|
getHLSStats() {
|
|
51260
|
-
var _a, _b, _c;
|
|
51261
|
-
|
|
51369
|
+
var _a, _b, _c, _d;
|
|
51370
|
+
const stats = ((_d = (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.hls) == null ? void 0 : _c.getStats) == null ? void 0 : _d.call(_c)) ?? {};
|
|
51371
|
+
return this._mergeSEIDelayStats(stats);
|
|
51262
51372
|
}
|
|
51263
51373
|
/** {en}
|
|
51264
51374
|
* @brief This method is used to update the playlist, supporting updates to source, resolution, and related information.
|
|
@@ -51286,6 +51396,40 @@ class VePlayerLive extends VePlayerBase {
|
|
|
51286
51396
|
}
|
|
51287
51397
|
return super.updatePlaylist(playlist, target);
|
|
51288
51398
|
}
|
|
51399
|
+
_getPlayerBufferTime() {
|
|
51400
|
+
var _a, _b, _c, _d, _e2;
|
|
51401
|
+
try {
|
|
51402
|
+
const rtm = ((_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) ?? ((_d = (_c = this._player) == null ? void 0 : _c.plugins) == null ? void 0 : _d.rtm);
|
|
51403
|
+
if (rtm) {
|
|
51404
|
+
const jitterBufferDelay = rtm.jitterBufferDelay;
|
|
51405
|
+
if (Number.isFinite(jitterBufferDelay) && jitterBufferDelay >= 0) {
|
|
51406
|
+
return jitterBufferDelay;
|
|
51407
|
+
}
|
|
51408
|
+
}
|
|
51409
|
+
} catch (e2) {
|
|
51410
|
+
}
|
|
51411
|
+
const video = (_e2 = this._player) == null ? void 0 : _e2.video;
|
|
51412
|
+
const buffered = video == null ? void 0 : video.buffered;
|
|
51413
|
+
if (!video || !(buffered == null ? void 0 : buffered.length)) {
|
|
51414
|
+
return 0;
|
|
51415
|
+
}
|
|
51416
|
+
try {
|
|
51417
|
+
return Math.trunc(
|
|
51418
|
+
(buffered.end(buffered.length - 1) - video.currentTime) * 1e3
|
|
51419
|
+
);
|
|
51420
|
+
} catch (e2) {
|
|
51421
|
+
return 0;
|
|
51422
|
+
}
|
|
51423
|
+
}
|
|
51424
|
+
_mergeSEIDelayStats(stats) {
|
|
51425
|
+
if (!stats) {
|
|
51426
|
+
return stats;
|
|
51427
|
+
}
|
|
51428
|
+
return {
|
|
51429
|
+
...stats,
|
|
51430
|
+
...this._seiDelayStats
|
|
51431
|
+
};
|
|
51432
|
+
}
|
|
51289
51433
|
}
|
|
51290
51434
|
async function createLivePlayer(options) {
|
|
51291
51435
|
var _a, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k;
|
|
@@ -51318,6 +51462,10 @@ async function createLivePlayer(options) {
|
|
|
51318
51462
|
playerOptions,
|
|
51319
51463
|
recommendation
|
|
51320
51464
|
);
|
|
51465
|
+
finalOptions.rtm = {
|
|
51466
|
+
enableSei: true,
|
|
51467
|
+
...finalOptions.rtm
|
|
51468
|
+
};
|
|
51321
51469
|
await liveLicenseManager.create();
|
|
51322
51470
|
const licenseFatalError = liveLicenseManager.getLicenseFatalError();
|
|
51323
51471
|
const protocolManager = await ProtocolManager.create(finalOptions);
|
|
@@ -51421,7 +51569,7 @@ async function prepare(options) {
|
|
|
51421
51569
|
}
|
|
51422
51570
|
await ((_a = liveVeStrategy.veStrategyManager) == null ? void 0 : _a.init({
|
|
51423
51571
|
...options,
|
|
51424
|
-
playerVersion: "2.3.
|
|
51572
|
+
playerVersion: "2.3.1-rc.1",
|
|
51425
51573
|
type: "LIVE"
|
|
51426
51574
|
}));
|
|
51427
51575
|
return liveVeStrategy.veStrategyManager;
|