@volcengine/veplayer 2.12.2-rc.0 → 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/index.d.ts +0 -2
- package/esm/veplayer.biz.live.development.js +154 -8
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +86 -75
- package/esm/veplayer.development.js +157 -15
- package/esm/veplayer.live.d.ts +86 -75
- package/esm/veplayer.live.development.js +157 -15
- package/esm/veplayer.live.production.js +3 -3
- package/esm/veplayer.production.js +3 -3
- package/esm/veplayer.vod.d.ts +0 -2
- package/esm/veplayer.vod.development.js +1 -7
- package/esm/veplayer.vod.production.js +2 -2
- package/package.json +1 -1
- package/umd/index.d.ts +0 -2
- package/umd/veplayer.biz.live.development.js +154 -8
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +86 -75
- package/umd/veplayer.development.js +157 -15
- package/umd/veplayer.live.d.ts +86 -75
- package/umd/veplayer.live.development.js +157 -15
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.d.ts +0 -2
- package/umd/veplayer.vod.development.js +1 -7
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +86 -75
- package/veplayer.live.d.ts +86 -75
- package/veplayer.vod.d.ts +0 -2
package/package.json
CHANGED
package/umd/index.d.ts
CHANGED
|
@@ -5080,7 +5080,6 @@ declare namespace error {
|
|
|
5080
5080
|
declare namespace event {
|
|
5081
5081
|
const BaseEvents: {
|
|
5082
5082
|
SEI: string;
|
|
5083
|
-
SEI_IN_TIME: string;
|
|
5084
5083
|
PLAYER_CREATE_FINISH: string;
|
|
5085
5084
|
FALLBACK_ERROR: string;
|
|
5086
5085
|
FALLBACK: string;
|
|
@@ -5125,7 +5124,6 @@ declare namespace event {
|
|
|
5125
5124
|
};
|
|
5126
5125
|
const Events: {
|
|
5127
5126
|
SEI: string;
|
|
5128
|
-
SEI_IN_TIME: string;
|
|
5129
5127
|
PLAYER_CREATE_FINISH: string;
|
|
5130
5128
|
FALLBACK_ERROR: string;
|
|
5131
5129
|
FALLBACK: string;
|
|
@@ -26737,7 +26737,6 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
|
|
|
26737
26737
|
return transform ? transform(value) : value.toString();
|
|
26738
26738
|
}
|
|
26739
26739
|
function getDefaultRow(data2) {
|
|
26740
|
-
var _a;
|
|
26741
26740
|
return {
|
|
26742
26741
|
rows: [
|
|
26743
26742
|
{
|
|
@@ -26778,7 +26777,10 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
|
|
|
26778
26777
|
{
|
|
26779
26778
|
key: "bufferEnd",
|
|
26780
26779
|
labelTextKey: "BUFFER_END",
|
|
26781
|
-
value: normalizeNumber(
|
|
26780
|
+
value: normalizeNumber(
|
|
26781
|
+
data2.bufferEnd,
|
|
26782
|
+
(value) => Number(value.toFixed(2)).toString()
|
|
26783
|
+
)
|
|
26782
26784
|
},
|
|
26783
26785
|
{
|
|
26784
26786
|
key: "currentTime",
|
|
@@ -29237,8 +29239,6 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
|
|
|
29237
29239
|
const BaseEvents = {
|
|
29238
29240
|
// sei
|
|
29239
29241
|
SEI: "sei",
|
|
29240
|
-
// sei,在播放时间对齐到该 sei 的时间戳时抛出
|
|
29241
|
-
SEI_IN_TIME: "seiInTime",
|
|
29242
29242
|
// 播放器完成创建
|
|
29243
29243
|
PLAYER_CREATE_FINISH: "playerCreateFinish",
|
|
29244
29244
|
FALLBACK_ERROR: "fallbackError",
|
|
@@ -51022,6 +51022,79 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51022
51022
|
}
|
|
51023
51023
|
}
|
|
51024
51024
|
const liveVeStrategy = new LiveVeStrategy();
|
|
51025
|
+
const isNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
51026
|
+
const getTimestamp = (delaySEI, currentKey, legacyKey) => {
|
|
51027
|
+
const currentValue = delaySEI[currentKey];
|
|
51028
|
+
if (isNumber(currentValue)) {
|
|
51029
|
+
return currentValue;
|
|
51030
|
+
}
|
|
51031
|
+
const legacyValue = delaySEI[legacyKey];
|
|
51032
|
+
return isNumber(legacyValue) ? legacyValue : void 0;
|
|
51033
|
+
};
|
|
51034
|
+
const utf8ArrayToString = (array) => {
|
|
51035
|
+
let result = "";
|
|
51036
|
+
let index = 0;
|
|
51037
|
+
while (index < array.length) {
|
|
51038
|
+
const first = array[index++];
|
|
51039
|
+
if (first < 128) {
|
|
51040
|
+
result += String.fromCharCode(first);
|
|
51041
|
+
} else if (first < 224) {
|
|
51042
|
+
const second = array[index++];
|
|
51043
|
+
result += String.fromCharCode((first & 31) << 6 | second & 63);
|
|
51044
|
+
} else {
|
|
51045
|
+
const second = array[index++];
|
|
51046
|
+
const third = array[index++];
|
|
51047
|
+
result += String.fromCharCode(
|
|
51048
|
+
(first & 15) << 12 | (second & 63) << 6 | third & 63
|
|
51049
|
+
);
|
|
51050
|
+
}
|
|
51051
|
+
}
|
|
51052
|
+
return result;
|
|
51053
|
+
};
|
|
51054
|
+
const getSEIDelayStats = (sei, bufferTime = 0, now3 = Date.now()) => {
|
|
51055
|
+
if ((sei == null ? void 0 : sei.code) !== 100 || !sei.content) {
|
|
51056
|
+
return;
|
|
51057
|
+
}
|
|
51058
|
+
try {
|
|
51059
|
+
const rawSEI = utf8ArrayToString(sei.content);
|
|
51060
|
+
const jsonStart = rawSEI.indexOf("{");
|
|
51061
|
+
const jsonEnd = rawSEI.lastIndexOf("}");
|
|
51062
|
+
if (jsonStart < 0 || jsonEnd < jsonStart) {
|
|
51063
|
+
return;
|
|
51064
|
+
}
|
|
51065
|
+
const seiContent = JSON.parse(rawSEI.slice(jsonStart, jsonEnd + 1));
|
|
51066
|
+
const delaySEI = seiContent == null ? void 0 : seiContent.video_e2e_delay;
|
|
51067
|
+
if (!delaySEI || typeof delaySEI !== "object") {
|
|
51068
|
+
return;
|
|
51069
|
+
}
|
|
51070
|
+
const push3 = getTimestamp(delaySEI, "push_edge_ts", "push_node");
|
|
51071
|
+
const source = getTimestamp(delaySEI, "source_ts", "source_node");
|
|
51072
|
+
const cmafSource = getTimestamp(
|
|
51073
|
+
delaySEI,
|
|
51074
|
+
"cmaf_source_ts",
|
|
51075
|
+
"cmaf_source_node"
|
|
51076
|
+
);
|
|
51077
|
+
const hlsSource = getTimestamp(
|
|
51078
|
+
delaySEI,
|
|
51079
|
+
"hls_source_ts",
|
|
51080
|
+
"hls_source_node"
|
|
51081
|
+
);
|
|
51082
|
+
const pull = getTimestamp(delaySEI, "pull_edge_ts", "pull_node");
|
|
51083
|
+
const start = push3 ?? source;
|
|
51084
|
+
const end = pull ?? hlsSource ?? cmafSource;
|
|
51085
|
+
if (!isNumber(start) || !isNumber(end)) {
|
|
51086
|
+
return;
|
|
51087
|
+
}
|
|
51088
|
+
const delayS2S = end - start;
|
|
51089
|
+
const safeBufferTime = isNumber(bufferTime) ? Math.max(0, bufferTime) : 0;
|
|
51090
|
+
return {
|
|
51091
|
+
delay_s2s: delayS2S,
|
|
51092
|
+
delay_s2e: delayS2S + Math.max(0, now3 - end) + safeBufferTime
|
|
51093
|
+
};
|
|
51094
|
+
} catch (e2) {
|
|
51095
|
+
return;
|
|
51096
|
+
}
|
|
51097
|
+
};
|
|
51025
51098
|
const DEFAULT_PLUGINS = window["VePlayer"].DEFAULT_PLUGINS;
|
|
51026
51099
|
const VePlayerBase = window["VePlayer"].VePlayerBase;
|
|
51027
51100
|
const VeI18n = window["VePlayer"].VeI18n;
|
|
@@ -51064,6 +51137,22 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51064
51137
|
* @hidden
|
|
51065
51138
|
*/
|
|
51066
51139
|
__publicField(this, "_protocolManager");
|
|
51140
|
+
__publicField(this, "_seiDelayStats", {});
|
|
51141
|
+
__publicField(this, "_resetSEIDelayStats", () => {
|
|
51142
|
+
this._seiDelayStats = {};
|
|
51143
|
+
});
|
|
51144
|
+
__publicField(this, "_handleSEI", (data2) => {
|
|
51145
|
+
const stats = getSEIDelayStats(data2 == null ? void 0 : data2.sei, this._getPlayerBufferTime());
|
|
51146
|
+
if (stats) {
|
|
51147
|
+
this._seiDelayStats = stats;
|
|
51148
|
+
}
|
|
51149
|
+
});
|
|
51150
|
+
this.on(Events$1.SEI, this._handleSEI);
|
|
51151
|
+
this.on(Events$1.URL_CHANGE, this._resetSEIDelayStats);
|
|
51152
|
+
this.on(Events$1.SOURCE_CHANGE, this._resetSEIDelayStats);
|
|
51153
|
+
this.on(Events$1.DEFINITION_CHANGE, this._resetSEIDelayStats);
|
|
51154
|
+
this.on(Events$1.REPLAY, this._resetSEIDelayStats);
|
|
51155
|
+
this.on(Events$1.FALLBACK, this._resetSEIDelayStats);
|
|
51067
51156
|
}
|
|
51068
51157
|
/** {zh}
|
|
51069
51158
|
* @brief 获取已经播放的时长,不包含暂停和等待时间,单位为秒。
|
|
@@ -51105,6 +51194,22 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51105
51194
|
var _a, _b;
|
|
51106
51195
|
return (_b = (_a = this._player.plugins) == null ? void 0 : _a.hls) == null ? void 0 : _b.hls;
|
|
51107
51196
|
}
|
|
51197
|
+
/** {zh}
|
|
51198
|
+
* @hidden
|
|
51199
|
+
*/
|
|
51200
|
+
/** {en}
|
|
51201
|
+
* @hidden
|
|
51202
|
+
*/
|
|
51203
|
+
destroy() {
|
|
51204
|
+
this.off(Events$1.SEI, this._handleSEI);
|
|
51205
|
+
this.off(Events$1.URL_CHANGE, this._resetSEIDelayStats);
|
|
51206
|
+
this.off(Events$1.SOURCE_CHANGE, this._resetSEIDelayStats);
|
|
51207
|
+
this.off(Events$1.DEFINITION_CHANGE, this._resetSEIDelayStats);
|
|
51208
|
+
this.off(Events$1.REPLAY, this._resetSEIDelayStats);
|
|
51209
|
+
this.off(Events$1.FALLBACK, this._resetSEIDelayStats);
|
|
51210
|
+
this._resetSEIDelayStats();
|
|
51211
|
+
super.destroy();
|
|
51212
|
+
}
|
|
51108
51213
|
/** {zh}
|
|
51109
51214
|
* @brief 调用此方法开启直播日志上报。
|
|
51110
51215
|
*/
|
|
@@ -51241,7 +51346,8 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51241
51346
|
*/
|
|
51242
51347
|
async getRTMStats() {
|
|
51243
51348
|
var _a, _b, _c;
|
|
51244
|
-
|
|
51349
|
+
const stats = await ((_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getStatsSnapshoot());
|
|
51350
|
+
return this._mergeSEIDelayStats(stats);
|
|
51245
51351
|
}
|
|
51246
51352
|
/** {zh}
|
|
51247
51353
|
* @brief 获取 FLV 拉流的播放信息。
|
|
@@ -51252,7 +51358,8 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51252
51358
|
*/
|
|
51253
51359
|
getFLVStats() {
|
|
51254
51360
|
var _a, _b, _c;
|
|
51255
|
-
|
|
51361
|
+
const stats = (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.flv) == null ? void 0 : _c.getStats();
|
|
51362
|
+
return this._mergeSEIDelayStats(stats);
|
|
51256
51363
|
}
|
|
51257
51364
|
/** {zh}
|
|
51258
51365
|
* @brief 获取 HLS 拉流的播放信息。
|
|
@@ -51264,8 +51371,9 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51264
51371
|
* @hidden
|
|
51265
51372
|
*/
|
|
51266
51373
|
getHLSStats() {
|
|
51267
|
-
var _a, _b, _c;
|
|
51268
|
-
|
|
51374
|
+
var _a, _b, _c, _d;
|
|
51375
|
+
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)) ?? {};
|
|
51376
|
+
return this._mergeSEIDelayStats(stats);
|
|
51269
51377
|
}
|
|
51270
51378
|
/** {en}
|
|
51271
51379
|
* @brief This method is used to update the playlist, supporting updates to source, resolution, and related information.
|
|
@@ -51293,6 +51401,40 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51293
51401
|
}
|
|
51294
51402
|
return super.updatePlaylist(playlist, target);
|
|
51295
51403
|
}
|
|
51404
|
+
_getPlayerBufferTime() {
|
|
51405
|
+
var _a, _b, _c, _d, _e2;
|
|
51406
|
+
try {
|
|
51407
|
+
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);
|
|
51408
|
+
if (rtm) {
|
|
51409
|
+
const jitterBufferDelay = rtm.jitterBufferDelay;
|
|
51410
|
+
if (Number.isFinite(jitterBufferDelay) && jitterBufferDelay >= 0) {
|
|
51411
|
+
return jitterBufferDelay;
|
|
51412
|
+
}
|
|
51413
|
+
}
|
|
51414
|
+
} catch (e2) {
|
|
51415
|
+
}
|
|
51416
|
+
const video = (_e2 = this._player) == null ? void 0 : _e2.video;
|
|
51417
|
+
const buffered = video == null ? void 0 : video.buffered;
|
|
51418
|
+
if (!video || !(buffered == null ? void 0 : buffered.length)) {
|
|
51419
|
+
return 0;
|
|
51420
|
+
}
|
|
51421
|
+
try {
|
|
51422
|
+
return Math.trunc(
|
|
51423
|
+
(buffered.end(buffered.length - 1) - video.currentTime) * 1e3
|
|
51424
|
+
);
|
|
51425
|
+
} catch (e2) {
|
|
51426
|
+
return 0;
|
|
51427
|
+
}
|
|
51428
|
+
}
|
|
51429
|
+
_mergeSEIDelayStats(stats) {
|
|
51430
|
+
if (!stats) {
|
|
51431
|
+
return stats;
|
|
51432
|
+
}
|
|
51433
|
+
return {
|
|
51434
|
+
...stats,
|
|
51435
|
+
...this._seiDelayStats
|
|
51436
|
+
};
|
|
51437
|
+
}
|
|
51296
51438
|
}
|
|
51297
51439
|
async function createLivePlayer(options) {
|
|
51298
51440
|
var _a, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k;
|
|
@@ -51325,6 +51467,10 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51325
51467
|
playerOptions,
|
|
51326
51468
|
recommendation
|
|
51327
51469
|
);
|
|
51470
|
+
finalOptions.rtm = {
|
|
51471
|
+
enableSei: true,
|
|
51472
|
+
...finalOptions.rtm
|
|
51473
|
+
};
|
|
51328
51474
|
await liveLicenseManager.create();
|
|
51329
51475
|
const licenseFatalError = liveLicenseManager.getLicenseFatalError();
|
|
51330
51476
|
const protocolManager = await ProtocolManager.create(finalOptions);
|