@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
|
@@ -14711,7 +14711,7 @@ class VePlayerBase {
|
|
|
14711
14711
|
* @brief Retrieve the player SDK version number.
|
|
14712
14712
|
*/
|
|
14713
14713
|
get playerVersion() {
|
|
14714
|
-
return "2.
|
|
14714
|
+
return "2.13.1-rc.0";
|
|
14715
14715
|
}
|
|
14716
14716
|
/** {zh}
|
|
14717
14717
|
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
@@ -56506,7 +56506,7 @@ let Logger$1 = class Logger2 extends Plugin {
|
|
|
56506
56506
|
device_id: deviceId,
|
|
56507
56507
|
error_report_stop: true,
|
|
56508
56508
|
ext: {
|
|
56509
|
-
veplayer_version: "2.
|
|
56509
|
+
veplayer_version: "2.13.1-rc.0",
|
|
56510
56510
|
flv_version: "3.0.24-rc.6",
|
|
56511
56511
|
hls_version: "3.0.24-rc.2",
|
|
56512
56512
|
rts_version: "0.2.1-alpha.64"
|
|
@@ -56520,7 +56520,6 @@ function normalizeNumber(value, transform2) {
|
|
|
56520
56520
|
return transform2 ? transform2(value) : value.toString();
|
|
56521
56521
|
}
|
|
56522
56522
|
function getDefaultRow(data2) {
|
|
56523
|
-
var _a;
|
|
56524
56523
|
return {
|
|
56525
56524
|
rows: [
|
|
56526
56525
|
{
|
|
@@ -56561,7 +56560,10 @@ function getDefaultRow(data2) {
|
|
|
56561
56560
|
{
|
|
56562
56561
|
key: "bufferEnd",
|
|
56563
56562
|
labelTextKey: "BUFFER_END",
|
|
56564
|
-
value: normalizeNumber(
|
|
56563
|
+
value: normalizeNumber(
|
|
56564
|
+
data2.bufferEnd,
|
|
56565
|
+
(value) => Number(value.toFixed(2)).toString()
|
|
56566
|
+
)
|
|
56565
56567
|
},
|
|
56566
56568
|
{
|
|
56567
56569
|
key: "currentTime",
|
|
@@ -73909,6 +73911,79 @@ class LiveVeStrategy {
|
|
|
73909
73911
|
}
|
|
73910
73912
|
}
|
|
73911
73913
|
const liveVeStrategy = new LiveVeStrategy();
|
|
73914
|
+
const isNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
73915
|
+
const getTimestamp = (delaySEI, currentKey, legacyKey) => {
|
|
73916
|
+
const currentValue = delaySEI[currentKey];
|
|
73917
|
+
if (isNumber(currentValue)) {
|
|
73918
|
+
return currentValue;
|
|
73919
|
+
}
|
|
73920
|
+
const legacyValue = delaySEI[legacyKey];
|
|
73921
|
+
return isNumber(legacyValue) ? legacyValue : void 0;
|
|
73922
|
+
};
|
|
73923
|
+
const utf8ArrayToString = (array) => {
|
|
73924
|
+
let result = "";
|
|
73925
|
+
let index = 0;
|
|
73926
|
+
while (index < array.length) {
|
|
73927
|
+
const first = array[index++];
|
|
73928
|
+
if (first < 128) {
|
|
73929
|
+
result += String.fromCharCode(first);
|
|
73930
|
+
} else if (first < 224) {
|
|
73931
|
+
const second = array[index++];
|
|
73932
|
+
result += String.fromCharCode((first & 31) << 6 | second & 63);
|
|
73933
|
+
} else {
|
|
73934
|
+
const second = array[index++];
|
|
73935
|
+
const third = array[index++];
|
|
73936
|
+
result += String.fromCharCode(
|
|
73937
|
+
(first & 15) << 12 | (second & 63) << 6 | third & 63
|
|
73938
|
+
);
|
|
73939
|
+
}
|
|
73940
|
+
}
|
|
73941
|
+
return result;
|
|
73942
|
+
};
|
|
73943
|
+
const getSEIDelayStats = (sei, bufferTime = 0, now3 = Date.now()) => {
|
|
73944
|
+
if ((sei == null ? void 0 : sei.code) !== 100 || !sei.content) {
|
|
73945
|
+
return;
|
|
73946
|
+
}
|
|
73947
|
+
try {
|
|
73948
|
+
const rawSEI = utf8ArrayToString(sei.content);
|
|
73949
|
+
const jsonStart = rawSEI.indexOf("{");
|
|
73950
|
+
const jsonEnd = rawSEI.lastIndexOf("}");
|
|
73951
|
+
if (jsonStart < 0 || jsonEnd < jsonStart) {
|
|
73952
|
+
return;
|
|
73953
|
+
}
|
|
73954
|
+
const seiContent = JSON.parse(rawSEI.slice(jsonStart, jsonEnd + 1));
|
|
73955
|
+
const delaySEI = seiContent == null ? void 0 : seiContent.video_e2e_delay;
|
|
73956
|
+
if (!delaySEI || typeof delaySEI !== "object") {
|
|
73957
|
+
return;
|
|
73958
|
+
}
|
|
73959
|
+
const push3 = getTimestamp(delaySEI, "push_edge_ts", "push_node");
|
|
73960
|
+
const source = getTimestamp(delaySEI, "source_ts", "source_node");
|
|
73961
|
+
const cmafSource = getTimestamp(
|
|
73962
|
+
delaySEI,
|
|
73963
|
+
"cmaf_source_ts",
|
|
73964
|
+
"cmaf_source_node"
|
|
73965
|
+
);
|
|
73966
|
+
const hlsSource = getTimestamp(
|
|
73967
|
+
delaySEI,
|
|
73968
|
+
"hls_source_ts",
|
|
73969
|
+
"hls_source_node"
|
|
73970
|
+
);
|
|
73971
|
+
const pull = getTimestamp(delaySEI, "pull_edge_ts", "pull_node");
|
|
73972
|
+
const start = push3 ?? source;
|
|
73973
|
+
const end = pull ?? hlsSource ?? cmafSource;
|
|
73974
|
+
if (!isNumber(start) || !isNumber(end)) {
|
|
73975
|
+
return;
|
|
73976
|
+
}
|
|
73977
|
+
const delayS2S = end - start;
|
|
73978
|
+
const safeBufferTime = isNumber(bufferTime) ? Math.max(0, bufferTime) : 0;
|
|
73979
|
+
return {
|
|
73980
|
+
delay_s2s: delayS2S,
|
|
73981
|
+
delay_s2e: delayS2S + Math.max(0, now3 - end) + safeBufferTime
|
|
73982
|
+
};
|
|
73983
|
+
} catch (e2) {
|
|
73984
|
+
return;
|
|
73985
|
+
}
|
|
73986
|
+
};
|
|
73912
73987
|
VeI18n.extend([
|
|
73913
73988
|
{
|
|
73914
73989
|
LANG: "zh-cn",
|
|
@@ -73947,6 +74022,22 @@ class VePlayerLive extends VePlayerBase {
|
|
|
73947
74022
|
* @hidden
|
|
73948
74023
|
*/
|
|
73949
74024
|
__publicField(this, "_protocolManager");
|
|
74025
|
+
__publicField(this, "_seiDelayStats", {});
|
|
74026
|
+
__publicField(this, "_resetSEIDelayStats", () => {
|
|
74027
|
+
this._seiDelayStats = {};
|
|
74028
|
+
});
|
|
74029
|
+
__publicField(this, "_handleSEI", (data2) => {
|
|
74030
|
+
const stats = getSEIDelayStats(data2 == null ? void 0 : data2.sei, this._getPlayerBufferTime());
|
|
74031
|
+
if (stats) {
|
|
74032
|
+
this._seiDelayStats = stats;
|
|
74033
|
+
}
|
|
74034
|
+
});
|
|
74035
|
+
this.on(Events.SEI, this._handleSEI);
|
|
74036
|
+
this.on(Events.URL_CHANGE, this._resetSEIDelayStats);
|
|
74037
|
+
this.on(Events.SOURCE_CHANGE, this._resetSEIDelayStats);
|
|
74038
|
+
this.on(Events.DEFINITION_CHANGE, this._resetSEIDelayStats);
|
|
74039
|
+
this.on(Events.REPLAY, this._resetSEIDelayStats);
|
|
74040
|
+
this.on(Events.FALLBACK, this._resetSEIDelayStats);
|
|
73950
74041
|
}
|
|
73951
74042
|
/** {zh}
|
|
73952
74043
|
* @brief 获取已经播放的时长,不包含暂停和等待时间,单位为秒。
|
|
@@ -73988,6 +74079,22 @@ class VePlayerLive extends VePlayerBase {
|
|
|
73988
74079
|
var _a, _b;
|
|
73989
74080
|
return (_b = (_a = this._player.plugins) == null ? void 0 : _a.hls) == null ? void 0 : _b.hls;
|
|
73990
74081
|
}
|
|
74082
|
+
/** {zh}
|
|
74083
|
+
* @hidden
|
|
74084
|
+
*/
|
|
74085
|
+
/** {en}
|
|
74086
|
+
* @hidden
|
|
74087
|
+
*/
|
|
74088
|
+
destroy() {
|
|
74089
|
+
this.off(Events.SEI, this._handleSEI);
|
|
74090
|
+
this.off(Events.URL_CHANGE, this._resetSEIDelayStats);
|
|
74091
|
+
this.off(Events.SOURCE_CHANGE, this._resetSEIDelayStats);
|
|
74092
|
+
this.off(Events.DEFINITION_CHANGE, this._resetSEIDelayStats);
|
|
74093
|
+
this.off(Events.REPLAY, this._resetSEIDelayStats);
|
|
74094
|
+
this.off(Events.FALLBACK, this._resetSEIDelayStats);
|
|
74095
|
+
this._resetSEIDelayStats();
|
|
74096
|
+
super.destroy();
|
|
74097
|
+
}
|
|
73991
74098
|
/** {zh}
|
|
73992
74099
|
* @brief 调用此方法开启直播日志上报。
|
|
73993
74100
|
*/
|
|
@@ -74124,7 +74231,8 @@ class VePlayerLive extends VePlayerBase {
|
|
|
74124
74231
|
*/
|
|
74125
74232
|
async getRTMStats() {
|
|
74126
74233
|
var _a, _b, _c;
|
|
74127
|
-
|
|
74234
|
+
const stats = await ((_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getStatsSnapshoot());
|
|
74235
|
+
return this._mergeSEIDelayStats(stats);
|
|
74128
74236
|
}
|
|
74129
74237
|
/** {zh}
|
|
74130
74238
|
* @brief 获取 FLV 拉流的播放信息。
|
|
@@ -74135,7 +74243,8 @@ class VePlayerLive extends VePlayerBase {
|
|
|
74135
74243
|
*/
|
|
74136
74244
|
getFLVStats() {
|
|
74137
74245
|
var _a, _b, _c;
|
|
74138
|
-
|
|
74246
|
+
const stats = (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.flv) == null ? void 0 : _c.getStats();
|
|
74247
|
+
return this._mergeSEIDelayStats(stats);
|
|
74139
74248
|
}
|
|
74140
74249
|
/** {zh}
|
|
74141
74250
|
* @brief 获取 HLS 拉流的播放信息。
|
|
@@ -74147,8 +74256,9 @@ class VePlayerLive extends VePlayerBase {
|
|
|
74147
74256
|
* @hidden
|
|
74148
74257
|
*/
|
|
74149
74258
|
getHLSStats() {
|
|
74150
|
-
var _a, _b, _c;
|
|
74151
|
-
|
|
74259
|
+
var _a, _b, _c, _d;
|
|
74260
|
+
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)) ?? {};
|
|
74261
|
+
return this._mergeSEIDelayStats(stats);
|
|
74152
74262
|
}
|
|
74153
74263
|
/** {en}
|
|
74154
74264
|
* @brief This method is used to update the playlist, supporting updates to source, resolution, and related information.
|
|
@@ -74176,6 +74286,40 @@ class VePlayerLive extends VePlayerBase {
|
|
|
74176
74286
|
}
|
|
74177
74287
|
return super.updatePlaylist(playlist, target);
|
|
74178
74288
|
}
|
|
74289
|
+
_getPlayerBufferTime() {
|
|
74290
|
+
var _a, _b, _c, _d, _e2;
|
|
74291
|
+
try {
|
|
74292
|
+
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);
|
|
74293
|
+
if (rtm) {
|
|
74294
|
+
const jitterBufferDelay = rtm.jitterBufferDelay;
|
|
74295
|
+
if (Number.isFinite(jitterBufferDelay) && jitterBufferDelay >= 0) {
|
|
74296
|
+
return jitterBufferDelay;
|
|
74297
|
+
}
|
|
74298
|
+
}
|
|
74299
|
+
} catch (e2) {
|
|
74300
|
+
}
|
|
74301
|
+
const video = (_e2 = this._player) == null ? void 0 : _e2.video;
|
|
74302
|
+
const buffered = video == null ? void 0 : video.buffered;
|
|
74303
|
+
if (!video || !(buffered == null ? void 0 : buffered.length)) {
|
|
74304
|
+
return 0;
|
|
74305
|
+
}
|
|
74306
|
+
try {
|
|
74307
|
+
return Math.trunc(
|
|
74308
|
+
(buffered.end(buffered.length - 1) - video.currentTime) * 1e3
|
|
74309
|
+
);
|
|
74310
|
+
} catch (e2) {
|
|
74311
|
+
return 0;
|
|
74312
|
+
}
|
|
74313
|
+
}
|
|
74314
|
+
_mergeSEIDelayStats(stats) {
|
|
74315
|
+
if (!stats) {
|
|
74316
|
+
return stats;
|
|
74317
|
+
}
|
|
74318
|
+
return {
|
|
74319
|
+
...stats,
|
|
74320
|
+
...this._seiDelayStats
|
|
74321
|
+
};
|
|
74322
|
+
}
|
|
74179
74323
|
}
|
|
74180
74324
|
async function createLivePlayer(options) {
|
|
74181
74325
|
var _a, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k;
|
|
@@ -74208,6 +74352,10 @@ async function createLivePlayer(options) {
|
|
|
74208
74352
|
playerOptions,
|
|
74209
74353
|
recommendation
|
|
74210
74354
|
);
|
|
74355
|
+
finalOptions.rtm = {
|
|
74356
|
+
enableSei: true,
|
|
74357
|
+
...finalOptions.rtm
|
|
74358
|
+
};
|
|
74211
74359
|
await liveLicenseManager.create();
|
|
74212
74360
|
const licenseFatalError = liveLicenseManager.getLicenseFatalError();
|
|
74213
74361
|
const protocolManager = await ProtocolManager.create(finalOptions);
|
|
@@ -74311,7 +74459,7 @@ async function prepare(options) {
|
|
|
74311
74459
|
}
|
|
74312
74460
|
await ((_a = liveVeStrategy.veStrategyManager) == null ? void 0 : _a.init({
|
|
74313
74461
|
...options,
|
|
74314
|
-
playerVersion: "2.
|
|
74462
|
+
playerVersion: "2.13.1-rc.0",
|
|
74315
74463
|
type: "LIVE"
|
|
74316
74464
|
}));
|
|
74317
74465
|
return liveVeStrategy.veStrategyManager;
|