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