@byteplus/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",
|
|
@@ -51023,6 +51023,79 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51023
51023
|
}
|
|
51024
51024
|
}
|
|
51025
51025
|
const liveVeStrategy = new LiveVeStrategy();
|
|
51026
|
+
const isNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
51027
|
+
const getTimestamp = (delaySEI, currentKey, legacyKey) => {
|
|
51028
|
+
const currentValue = delaySEI[currentKey];
|
|
51029
|
+
if (isNumber(currentValue)) {
|
|
51030
|
+
return currentValue;
|
|
51031
|
+
}
|
|
51032
|
+
const legacyValue = delaySEI[legacyKey];
|
|
51033
|
+
return isNumber(legacyValue) ? legacyValue : void 0;
|
|
51034
|
+
};
|
|
51035
|
+
const utf8ArrayToString = (array) => {
|
|
51036
|
+
let result = "";
|
|
51037
|
+
let index = 0;
|
|
51038
|
+
while (index < array.length) {
|
|
51039
|
+
const first = array[index++];
|
|
51040
|
+
if (first < 128) {
|
|
51041
|
+
result += String.fromCharCode(first);
|
|
51042
|
+
} else if (first < 224) {
|
|
51043
|
+
const second = array[index++];
|
|
51044
|
+
result += String.fromCharCode((first & 31) << 6 | second & 63);
|
|
51045
|
+
} else {
|
|
51046
|
+
const second = array[index++];
|
|
51047
|
+
const third = array[index++];
|
|
51048
|
+
result += String.fromCharCode(
|
|
51049
|
+
(first & 15) << 12 | (second & 63) << 6 | third & 63
|
|
51050
|
+
);
|
|
51051
|
+
}
|
|
51052
|
+
}
|
|
51053
|
+
return result;
|
|
51054
|
+
};
|
|
51055
|
+
const getSEIDelayStats = (sei, bufferTime = 0, now3 = Date.now()) => {
|
|
51056
|
+
if ((sei == null ? void 0 : sei.code) !== 100 || !sei.content) {
|
|
51057
|
+
return;
|
|
51058
|
+
}
|
|
51059
|
+
try {
|
|
51060
|
+
const rawSEI = utf8ArrayToString(sei.content);
|
|
51061
|
+
const jsonStart = rawSEI.indexOf("{");
|
|
51062
|
+
const jsonEnd = rawSEI.lastIndexOf("}");
|
|
51063
|
+
if (jsonStart < 0 || jsonEnd < jsonStart) {
|
|
51064
|
+
return;
|
|
51065
|
+
}
|
|
51066
|
+
const seiContent = JSON.parse(rawSEI.slice(jsonStart, jsonEnd + 1));
|
|
51067
|
+
const delaySEI = seiContent == null ? void 0 : seiContent.video_e2e_delay;
|
|
51068
|
+
if (!delaySEI || typeof delaySEI !== "object") {
|
|
51069
|
+
return;
|
|
51070
|
+
}
|
|
51071
|
+
const push3 = getTimestamp(delaySEI, "push_edge_ts", "push_node");
|
|
51072
|
+
const source = getTimestamp(delaySEI, "source_ts", "source_node");
|
|
51073
|
+
const cmafSource = getTimestamp(
|
|
51074
|
+
delaySEI,
|
|
51075
|
+
"cmaf_source_ts",
|
|
51076
|
+
"cmaf_source_node"
|
|
51077
|
+
);
|
|
51078
|
+
const hlsSource = getTimestamp(
|
|
51079
|
+
delaySEI,
|
|
51080
|
+
"hls_source_ts",
|
|
51081
|
+
"hls_source_node"
|
|
51082
|
+
);
|
|
51083
|
+
const pull = getTimestamp(delaySEI, "pull_edge_ts", "pull_node");
|
|
51084
|
+
const start = push3 ?? source;
|
|
51085
|
+
const end = pull ?? hlsSource ?? cmafSource;
|
|
51086
|
+
if (!isNumber(start) || !isNumber(end)) {
|
|
51087
|
+
return;
|
|
51088
|
+
}
|
|
51089
|
+
const delayS2S = end - start;
|
|
51090
|
+
const safeBufferTime = isNumber(bufferTime) ? Math.max(0, bufferTime) : 0;
|
|
51091
|
+
return {
|
|
51092
|
+
delay_s2s: delayS2S,
|
|
51093
|
+
delay_s2e: delayS2S + Math.max(0, now3 - end) + safeBufferTime
|
|
51094
|
+
};
|
|
51095
|
+
} catch (e2) {
|
|
51096
|
+
return;
|
|
51097
|
+
}
|
|
51098
|
+
};
|
|
51026
51099
|
const DEFAULT_PLUGINS = window["VePlayer"].DEFAULT_PLUGINS;
|
|
51027
51100
|
const VePlayerBase = window["VePlayer"].VePlayerBase;
|
|
51028
51101
|
const VeI18n = window["VePlayer"].VeI18n;
|
|
@@ -51065,6 +51138,22 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51065
51138
|
* @hidden
|
|
51066
51139
|
*/
|
|
51067
51140
|
__publicField(this, "_protocolManager");
|
|
51141
|
+
__publicField(this, "_seiDelayStats", {});
|
|
51142
|
+
__publicField(this, "_resetSEIDelayStats", () => {
|
|
51143
|
+
this._seiDelayStats = {};
|
|
51144
|
+
});
|
|
51145
|
+
__publicField(this, "_handleSEI", (data2) => {
|
|
51146
|
+
const stats = getSEIDelayStats(data2 == null ? void 0 : data2.sei, this._getPlayerBufferTime());
|
|
51147
|
+
if (stats) {
|
|
51148
|
+
this._seiDelayStats = stats;
|
|
51149
|
+
}
|
|
51150
|
+
});
|
|
51151
|
+
this.on(Events$1.SEI, this._handleSEI);
|
|
51152
|
+
this.on(Events$1.URL_CHANGE, this._resetSEIDelayStats);
|
|
51153
|
+
this.on(Events$1.SOURCE_CHANGE, this._resetSEIDelayStats);
|
|
51154
|
+
this.on(Events$1.DEFINITION_CHANGE, this._resetSEIDelayStats);
|
|
51155
|
+
this.on(Events$1.REPLAY, this._resetSEIDelayStats);
|
|
51156
|
+
this.on(Events$1.FALLBACK, this._resetSEIDelayStats);
|
|
51068
51157
|
}
|
|
51069
51158
|
/** {zh}
|
|
51070
51159
|
* @brief 获取已经播放的时长,不包含暂停和等待时间,单位为秒。
|
|
@@ -51106,6 +51195,22 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51106
51195
|
var _a, _b;
|
|
51107
51196
|
return (_b = (_a = this._player.plugins) == null ? void 0 : _a.hls) == null ? void 0 : _b.hls;
|
|
51108
51197
|
}
|
|
51198
|
+
/** {zh}
|
|
51199
|
+
* @hidden
|
|
51200
|
+
*/
|
|
51201
|
+
/** {en}
|
|
51202
|
+
* @hidden
|
|
51203
|
+
*/
|
|
51204
|
+
destroy() {
|
|
51205
|
+
this.off(Events$1.SEI, this._handleSEI);
|
|
51206
|
+
this.off(Events$1.URL_CHANGE, this._resetSEIDelayStats);
|
|
51207
|
+
this.off(Events$1.SOURCE_CHANGE, this._resetSEIDelayStats);
|
|
51208
|
+
this.off(Events$1.DEFINITION_CHANGE, this._resetSEIDelayStats);
|
|
51209
|
+
this.off(Events$1.REPLAY, this._resetSEIDelayStats);
|
|
51210
|
+
this.off(Events$1.FALLBACK, this._resetSEIDelayStats);
|
|
51211
|
+
this._resetSEIDelayStats();
|
|
51212
|
+
super.destroy();
|
|
51213
|
+
}
|
|
51109
51214
|
/** {zh}
|
|
51110
51215
|
* @brief 调用此方法开启直播日志上报。
|
|
51111
51216
|
*/
|
|
@@ -51242,7 +51347,8 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51242
51347
|
*/
|
|
51243
51348
|
async getRTMStats() {
|
|
51244
51349
|
var _a, _b, _c;
|
|
51245
|
-
|
|
51350
|
+
const stats = await ((_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getStatsSnapshoot());
|
|
51351
|
+
return this._mergeSEIDelayStats(stats);
|
|
51246
51352
|
}
|
|
51247
51353
|
/** {zh}
|
|
51248
51354
|
* @brief 获取 FLV 拉流的播放信息。
|
|
@@ -51253,7 +51359,8 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51253
51359
|
*/
|
|
51254
51360
|
getFLVStats() {
|
|
51255
51361
|
var _a, _b, _c;
|
|
51256
|
-
|
|
51362
|
+
const stats = (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.flv) == null ? void 0 : _c.getStats();
|
|
51363
|
+
return this._mergeSEIDelayStats(stats);
|
|
51257
51364
|
}
|
|
51258
51365
|
/** {zh}
|
|
51259
51366
|
* @brief 获取 HLS 拉流的播放信息。
|
|
@@ -51265,8 +51372,9 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51265
51372
|
* @hidden
|
|
51266
51373
|
*/
|
|
51267
51374
|
getHLSStats() {
|
|
51268
|
-
var _a, _b, _c;
|
|
51269
|
-
|
|
51375
|
+
var _a, _b, _c, _d;
|
|
51376
|
+
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)) ?? {};
|
|
51377
|
+
return this._mergeSEIDelayStats(stats);
|
|
51270
51378
|
}
|
|
51271
51379
|
/** {en}
|
|
51272
51380
|
* @brief This method is used to update the playlist, supporting updates to source, resolution, and related information.
|
|
@@ -51294,6 +51402,40 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51294
51402
|
}
|
|
51295
51403
|
return super.updatePlaylist(playlist, target);
|
|
51296
51404
|
}
|
|
51405
|
+
_getPlayerBufferTime() {
|
|
51406
|
+
var _a, _b, _c, _d, _e2;
|
|
51407
|
+
try {
|
|
51408
|
+
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);
|
|
51409
|
+
if (rtm) {
|
|
51410
|
+
const jitterBufferDelay = rtm.jitterBufferDelay;
|
|
51411
|
+
if (Number.isFinite(jitterBufferDelay) && jitterBufferDelay >= 0) {
|
|
51412
|
+
return jitterBufferDelay;
|
|
51413
|
+
}
|
|
51414
|
+
}
|
|
51415
|
+
} catch (e2) {
|
|
51416
|
+
}
|
|
51417
|
+
const video = (_e2 = this._player) == null ? void 0 : _e2.video;
|
|
51418
|
+
const buffered = video == null ? void 0 : video.buffered;
|
|
51419
|
+
if (!video || !(buffered == null ? void 0 : buffered.length)) {
|
|
51420
|
+
return 0;
|
|
51421
|
+
}
|
|
51422
|
+
try {
|
|
51423
|
+
return Math.trunc(
|
|
51424
|
+
(buffered.end(buffered.length - 1) - video.currentTime) * 1e3
|
|
51425
|
+
);
|
|
51426
|
+
} catch (e2) {
|
|
51427
|
+
return 0;
|
|
51428
|
+
}
|
|
51429
|
+
}
|
|
51430
|
+
_mergeSEIDelayStats(stats) {
|
|
51431
|
+
if (!stats) {
|
|
51432
|
+
return stats;
|
|
51433
|
+
}
|
|
51434
|
+
return {
|
|
51435
|
+
...stats,
|
|
51436
|
+
...this._seiDelayStats
|
|
51437
|
+
};
|
|
51438
|
+
}
|
|
51297
51439
|
}
|
|
51298
51440
|
async function createLivePlayer(options) {
|
|
51299
51441
|
var _a, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k;
|
|
@@ -51326,6 +51468,10 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
|
|
|
51326
51468
|
playerOptions,
|
|
51327
51469
|
recommendation
|
|
51328
51470
|
);
|
|
51471
|
+
finalOptions.rtm = {
|
|
51472
|
+
enableSei: true,
|
|
51473
|
+
...finalOptions.rtm
|
|
51474
|
+
};
|
|
51329
51475
|
await liveLicenseManager.create();
|
|
51330
51476
|
const licenseFatalError = liveLicenseManager.getLicenseFatalError();
|
|
51331
51477
|
const protocolManager = await ProtocolManager.create(finalOptions);
|