@volcengine/veplayer 2.0.0-rc.2 → 2.1.0-rc.1

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.
Files changed (38) hide show
  1. package/README.md +14 -1
  2. package/esm/index.d.ts +17 -11
  3. package/esm/veplayer.biz.live.development.js +184 -45
  4. package/esm/veplayer.biz.live.production.js +1 -1
  5. package/esm/veplayer.d.ts +53 -28
  6. package/esm/veplayer.development.css +1 -1
  7. package/esm/veplayer.development.js +600 -234
  8. package/esm/veplayer.live.d.ts +53 -28
  9. package/esm/veplayer.live.development.css +1 -1
  10. package/esm/veplayer.live.development.js +600 -234
  11. package/esm/veplayer.live.production.css +1 -1
  12. package/esm/veplayer.live.production.js +4 -4
  13. package/esm/veplayer.production.css +1 -1
  14. package/esm/veplayer.production.js +4 -4
  15. package/esm/veplayer.vod.d.ts +17 -11
  16. package/esm/veplayer.vod.development.css +1 -1
  17. package/esm/veplayer.vod.development.js +402 -173
  18. package/esm/veplayer.vod.production.css +1 -1
  19. package/esm/veplayer.vod.production.js +4 -4
  20. package/package.json +2 -1
  21. package/umd/index.d.ts +17 -11
  22. package/umd/veplayer.biz.live.development.js +184 -45
  23. package/umd/veplayer.biz.live.production.js +1 -1
  24. package/umd/veplayer.d.ts +53 -28
  25. package/umd/veplayer.development.css +1 -1
  26. package/umd/veplayer.development.js +600 -234
  27. package/umd/veplayer.live.d.ts +53 -28
  28. package/umd/veplayer.live.development.css +1 -1
  29. package/umd/veplayer.live.development.js +598 -232
  30. package/umd/veplayer.live.production.css +1 -1
  31. package/umd/veplayer.live.production.js +1 -1
  32. package/umd/veplayer.production.css +1 -1
  33. package/umd/veplayer.production.js +1 -1
  34. package/umd/veplayer.vod.d.ts +17 -11
  35. package/umd/veplayer.vod.development.css +1 -1
  36. package/umd/veplayer.vod.development.js +402 -173
  37. package/umd/veplayer.vod.production.css +1 -1
  38. package/umd/veplayer.vod.production.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volcengine/veplayer",
3
- "version": "2.0.0-rc.2",
3
+ "version": "2.1.0-rc.1",
4
4
  "main": "./umd/veplayer.production.js",
5
5
  "module": "./esm/veplayer.production.js",
6
6
  "browser": "./umd/veplayer.production.js",
@@ -73,6 +73,7 @@
73
73
  "./vod/development/style": "./esm/veplayer.development.css"
74
74
  },
75
75
  "types": "./veplayer.d.ts",
76
+ "license": "BSD-3-Clause",
76
77
  "files": [
77
78
  "esm",
78
79
  "umd",
package/umd/index.d.ts CHANGED
@@ -79,7 +79,7 @@ declare class VeI18n<T extends string = TextKey> {
79
79
  texts?: Record<Lang, Record<string, string>>;
80
80
  };
81
81
  });
82
- static get langKeys(): any;
82
+ static get langKeys(): string[];
83
83
  static isLangValid(lang: Lang): boolean;
84
84
  static extend(i18nTextList: Array<IXGI18nText>, i18nLangs?: IXGI18n): void;
85
85
  setLang(lang: string): void;
@@ -106,6 +106,7 @@ declare class Definition implements XGDefinition {
106
106
  fallbackUrls?: string[];
107
107
  });
108
108
  get url(): string;
109
+ set url(url: string);
109
110
  next(): DefinitionUrl;
110
111
  }
111
112
  /**
@@ -1162,11 +1163,11 @@ declare class VePlayerBase {
1162
1163
  * @brief 获取和设置当前语言。
1163
1164
  */
1164
1165
  // eslint-disable-next-line @typescript-eslint/member-ordering
1165
- get lang(): "zh-cn" | "zh-hk" | string;
1166
+ get lang(): "zh-cn" | "en" | string;
1166
1167
  /**
1167
1168
  * @brief 获取和设置当前语言。
1168
1169
  */
1169
- set lang(lang: "zh-cn" | "zh-hk" | string);
1170
+ set lang(lang: "zh-cn" | "en" | string);
1170
1171
  // eslint-disable-next-line @typescript-eslint/member-ordering
1171
1172
  protected get _src(): string;
1172
1173
  /**
@@ -1296,7 +1297,7 @@ declare class VePlayerBase {
1296
1297
  * @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
1297
1298
  * @param el 全屏作用的 DOM 节点。
1298
1299
  */
1299
- getFullscreen(el?: HTMLElement): Promise<void>;
1300
+ requestFullscreen(el?: HTMLElement): Promise<void>;
1300
1301
  /**
1301
1302
  * @brief 调用此方法退出系统全屏状态,调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.FULLSCREEN_CHANGE` 事件。
1302
1303
  * @param el 全屏作用的 DOM 节点。
@@ -1306,7 +1307,7 @@ declare class VePlayerBase {
1306
1307
  * @brief 调用此方法进入网页样式全屏状态,播放器进入网页全屏,利用 CSS 模拟实现全屏效果。如果该接口调用的时候处于全屏状态,会自动退出全屏,下发事件 `Events.CSS_FULLSCREEN_CHANGE`。
1307
1308
  * @param el 全屏作用的 DOM 节点。
1308
1309
  */
1309
- getCssFullscreen(el?: HTMLElement): void;
1310
+ requestCssFullscreen(el?: HTMLElement): void;
1310
1311
  /**
1311
1312
  * @brief 调用此方法退出网页样式全屏状态。 调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.CSS_FULLSCREEN_CHANGE` 事件。
1312
1313
  */
@@ -1355,7 +1356,10 @@ declare class VePlayerBase {
1355
1356
  /**
1356
1357
  * @hidden
1357
1358
  */
1358
- prepare(url: string): Promise<any[]>;
1359
+ prepare(url: string): Promise<{
1360
+ plugins: any[];
1361
+ options: Partial<VePlayerBaseOptions> | undefined;
1362
+ }>;
1359
1363
  private _handleFallback;
1360
1364
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1361
1365
  private _transformEvent;
@@ -1542,7 +1546,7 @@ declare namespace strategy {
1542
1546
  texts?: Record<Lang, Record<string, string>>;
1543
1547
  };
1544
1548
  });
1545
- static get langKeys(): any;
1549
+ static get langKeys(): string[];
1546
1550
  static isLangValid(lang: Lang): boolean;
1547
1551
  static extend(i18nTextList: Array<IXGI18nText>, i18nLangs?: IXGI18n): void;
1548
1552
  setLang(lang: string): void;
@@ -1570,6 +1574,7 @@ declare namespace strategy {
1570
1574
  fallbackUrls?: string[];
1571
1575
  });
1572
1576
  get url(): string;
1577
+ set url(url: string);
1573
1578
  next(): DefinitionUrl;
1574
1579
  }
1575
1580
  /**
@@ -2021,7 +2026,6 @@ declare namespace strategy {
2021
2026
  ext?: any;
2022
2027
  error?: Error;
2023
2028
  }
2024
- // 参考: https://bytedance.feishu.cn/docx/doxcnGPXIOrJk3dGE3E3YghgZke
2025
2029
  const ERROR_INFO: Partial<Record<ErrorCode, ErrorInfo>>;
2026
2030
  const ERROR_TYPE_INFO: Record<ErrorType, ErrorInfo>;
2027
2031
  /**
@@ -2196,7 +2200,9 @@ declare namespace strategy {
2196
2200
  };
2197
2201
  renderItemList(): void;
2198
2202
  onItemClick(_: never, data: {
2199
- to: Definition;
2203
+ to: Definition & {
2204
+ showText: string;
2205
+ };
2200
2206
  }): void;
2201
2207
  fallback(options?: {
2202
2208
  toast: boolean;
@@ -2799,7 +2805,7 @@ declare namespace error {
2799
2805
  texts?: Record<Lang, Record<string, string>>;
2800
2806
  };
2801
2807
  });
2802
- static get langKeys(): any;
2808
+ static get langKeys(): string[];
2803
2809
  static isLangValid(lang: Lang): boolean;
2804
2810
  static extend(i18nTextList: Array<IXGI18nText>, i18nLangs?: IXGI18n): void;
2805
2811
  setLang(lang: string): void;
@@ -3027,7 +3033,6 @@ declare namespace error {
3027
3033
  ext?: any;
3028
3034
  error?: Error;
3029
3035
  }
3030
- // 参考: https://bytedance.feishu.cn/docx/doxcnGPXIOrJk3dGE3E3YghgZke
3031
3036
  const ERROR_INFO: Partial<Record<ErrorCode, ErrorInfo>>;
3032
3037
  const ERROR_TYPE_INFO: Record<ErrorType, ErrorInfo>;
3033
3038
  /**
@@ -3127,6 +3132,7 @@ declare namespace event {
3127
3132
  DURATION_CHANGE: string;
3128
3133
  VOLUME_CHANGE: string;
3129
3134
  LOADED_DATA: string;
3135
+ LOADED_METADATA: string;
3130
3136
  RATE_CHANGE: string;
3131
3137
  PROGRESS: string;
3132
3138
  LOAD_START: string;
@@ -32,6 +32,18 @@ var __publicField = (obj, key, value) => {
32
32
  function create(errorCode, i18n) {
33
33
  return new VeError(ERRORS[errorCode], i18n);
34
34
  }
35
+ const DynamicModule$2 = window["VePlayer"].DynamicModule;
36
+ const load$2 = window["VePlayer"].load;
37
+ async function isRTMSupported() {
38
+ const Rtm = await load$2(DynamicModule$2.PluginRtm);
39
+ return Rtm.isSupported();
40
+ }
41
+ async function isRTMSupportCodec(codec = RTMCodec.H264) {
42
+ const Rtm = await load$2(DynamicModule$2.PluginRtm);
43
+ if (codec === RTMCodec.H264)
44
+ return Rtm.isSupportedH264();
45
+ return false;
46
+ }
35
47
  const strategy$1 = window["VePlayer"].strategy;
36
48
  const util$3 = window["VePlayer"].util;
37
49
  const DynamicModule$1 = window["VePlayer"].DynamicModule;
@@ -42,11 +54,20 @@ var __publicField = (obj, key, value) => {
42
54
  options: {},
43
55
  module: DynamicModule$1.PluginRtm
44
56
  };
45
- const getRtmStrategy = async (options) => {
57
+ const generateFallbackUrl = (url) => {
58
+ if (Sniffer$2.device === "pc") {
59
+ return url.replace(".sdp", ".flv");
60
+ } else {
61
+ return url.replace(".sdp", ".m3u8");
62
+ }
63
+ };
64
+ const getRtmStrategy = async (options, player) => {
46
65
  var _a;
47
66
  let backupStrategy;
48
- const { fallbackUrl, ...ret } = options.rtm || {};
49
- const backupType = fallbackUrl && util$3.getStreamType(fallbackUrl);
67
+ const { url } = options;
68
+ const { fallbackUrl, enableFallback = true, ...ret } = options.rtm || {};
69
+ const actualFallbackUrl = !enableFallback ? "" : !fallbackUrl && url ? generateFallbackUrl(url) : fallbackUrl;
70
+ const backupType = actualFallbackUrl && util$3.getStreamType(actualFallbackUrl);
50
71
  if (backupType === "flv" && util$3.isMseSupported(Codec$1.H264)) {
51
72
  backupStrategy = strategy$1.createFlvMseStrategy(options);
52
73
  } else if (backupType === "hls" && (Sniffer$2.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && util$3.isMseSupported(Codec$1.H264)) {
@@ -56,42 +77,57 @@ var __publicField = (obj, key, value) => {
56
77
  load$1(rtmStrategy.module).catch(() => void 0),
57
78
  backupStrategy && load$1(backupStrategy.module).catch(() => void 0)
58
79
  ]);
80
+ const [RTMSupported, RTMSupportCodec] = await Promise.all([
81
+ isRTMSupported(),
82
+ isRTMSupportCodec()
83
+ ]);
84
+ if (!RTMSupported || !RTMSupportCodec) {
85
+ if (player) {
86
+ player.emit("degrade", {
87
+ url: actualFallbackUrl,
88
+ originRtmUrl: url,
89
+ code: "NOT_SUPPORT",
90
+ message: "not support rtm or h264",
91
+ isRTMSupported: RTMSupported,
92
+ isRTMSupportCodec: RTMSupportCodec
93
+ });
94
+ }
95
+ return {
96
+ options: {
97
+ ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
98
+ url: actualFallbackUrl,
99
+ _RTMdegrade: {
100
+ _originRtmUrl: url,
101
+ _isRTMSupported: RTMSupported,
102
+ _isRTMSupportCodec: RTMSupportCodec
103
+ }
104
+ },
105
+ plugins: backupCdn ? [backupCdn] : []
106
+ };
107
+ }
59
108
  return {
60
109
  options: {
61
110
  ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
111
+ _RTMdegrade: void 0,
62
112
  rts: {
63
113
  retryCount: 0,
64
114
  ...ret,
65
- backupURL: fallbackUrl,
115
+ backupURL: actualFallbackUrl,
66
116
  backupConstruct: backupCdn
67
117
  }
68
118
  },
69
119
  plugins: rtmCdn ? [rtmCdn] : []
70
120
  };
71
121
  };
72
- var RTMCodec = /* @__PURE__ */ ((RTMCodec2) => {
73
- RTMCodec2["H264"] = "h264";
74
- return RTMCodec2;
75
- })(RTMCodec || {});
76
- const isRTMSupported = async () => {
77
- const Rtm = await load$1(DynamicModule$1.PluginRtm);
78
- return Rtm.isSupported();
79
- };
80
- const isRTMSupportCodec = async (codec = "h264") => {
81
- const Rtm = await load$1(DynamicModule$1.PluginRtm);
82
- if (codec === "h264")
83
- return Rtm.isSupportedH264();
84
- return false;
85
- };
86
122
  const util$2 = window["VePlayer"].util;
87
123
  const strategy = window["VePlayer"].strategy;
88
- const getTypeStrategy = async (options) => {
124
+ const getTypeStrategy = async (options, player) => {
89
125
  const type = options.url ? util$2.getStreamType(options.url) : "";
90
126
  if (!type || type === "unknown") {
91
127
  return { options: {}, plugins: [] };
92
128
  }
93
129
  if (type === "rtm") {
94
- return await getRtmStrategy(options);
130
+ return await getRtmStrategy(options, player);
95
131
  }
96
132
  if (type === "flv") {
97
133
  return await strategy.getFlvStrategy(options);
@@ -547,9 +583,9 @@ var __publicField = (obj, key, value) => {
547
583
  function isCodecSupport(codec) {
548
584
  return typeof MediaSource !== "undefined" ? +MediaSource.isTypeSupported("video/mp4; codecs=" + codec) : 0;
549
585
  }
550
- function getUrlQuery(url, key) {
586
+ function getUrlQuery(url, key, key2) {
551
587
  var x2 = new URLSearchParams(url.split("?")[1]);
552
- return x2.get(key);
588
+ return x2.get(key) || x2.get(key2);
553
589
  }
554
590
  function getDeviceInfo() {
555
591
  var res = {
@@ -576,19 +612,11 @@ var __publicField = (obj, key, value) => {
576
612
  return player.plugins.hls;
577
613
  } else if (player.plugins.rts) {
578
614
  return player.plugins.rts;
579
- } else if (player.plugins.flvlive) {
580
- return player.plugins.flvlive;
581
- } else if (player.plugins.hlslive) {
582
- return player.plugins.hlslive;
583
- } else if (player.plugins.hlsvod) {
584
- return player.plugins.hlsvod;
585
- } else if (player.plugins.hlslivemobile) {
586
- return player.plugins.hlslivemobile;
587
- } else if (player.plugins.flvlivemobile) {
588
- return player.plugins.flvlivemobile;
589
- }
590
- }
591
- return player.newHls || player.newFlv || player.__core__ || player.flv;
615
+ } else if (player.plugins.rtm) {
616
+ return player.plugins.rtm;
617
+ }
618
+ }
619
+ return null;
592
620
  }
593
621
  function getDefaultOptions(options) {
594
622
  return {
@@ -817,7 +845,7 @@ var __publicField = (obj, key, value) => {
817
845
  live_sdk_version: getPlayerCore(player) || player.hlsOps ? "2" : "-1",
818
846
  player_sdk_version: player.version,
819
847
  // eslint-disable-next-line no-undef
820
- logger_version: "1.1.0-alpha.5",
848
+ logger_version: "1.1.0-alpha.7",
821
849
  // 由rollup 在编译时注入
822
850
  report_version: "5",
823
851
  product_line: options.product_line,
@@ -941,9 +969,13 @@ var __publicField = (obj, key, value) => {
941
969
  if (this._player.video) {
942
970
  log.play_current_time = this._player.currentTime;
943
971
  }
944
- log.cdn_play_url = url && url.startsWith("//") ? window.location.protocol + url : url;
945
- log.live_stream_session_id = getUrlQuery(url, "session_id");
946
- log.play_format = getPlayFormat(url);
972
+ if (this.core && this.core.loader && this.core.loader.finnalUrl) {
973
+ log.cdn_play_url = this.core.loader.finnalUrl;
974
+ } else {
975
+ log.cdn_play_url = url && url.startsWith("//") ? window.location.protocol + url : url;
976
+ }
977
+ log.live_stream_session_id = getUrlQuery(log.cdn_play_url, "_session_id", "session_id");
978
+ log.play_format = getPlayFormat(log.cdn_play_url);
947
979
  log.timestamp = getCurrentTime();
948
980
  var _getDeviceInfo = getDeviceInfo(), cpu_core_number = _getDeviceInfo.cpu_core_number, memory_usage = _getDeviceInfo.memory_usage, network_downlink = _getDeviceInfo.network_downlink;
949
981
  log.cpu_core_number = cpu_core_number;
@@ -1169,6 +1201,11 @@ var __publicField = (obj, key, value) => {
1169
1201
  };
1170
1202
  _proto2.reportStartPlay = function reportStartPlay() {
1171
1203
  if (!this.started) {
1204
+ this.core = getPlayerCore(this.player);
1205
+ if (this.core) {
1206
+ this.commonParams.live_sdk_version = "2";
1207
+ this.logmanager.core = this.core;
1208
+ }
1172
1209
  this.started = true;
1173
1210
  this.log.start_play.start_play_time = this.log.start_play.timestamp = getCurrentTime();
1174
1211
  this.logmanager.push(this.log.start_play, true);
@@ -1433,6 +1470,7 @@ var __publicField = (obj, key, value) => {
1433
1470
  this.core = getPlayerCore(this.player);
1434
1471
  if (this.core) {
1435
1472
  this.commonParams.live_sdk_version = "2";
1473
+ this.logmanager.core = this.core;
1436
1474
  }
1437
1475
  if (this.player.config.autoplay || this.player.config.videoInit) {
1438
1476
  this.reportStartPlay();
@@ -2685,6 +2723,45 @@ var __publicField = (obj, key, value) => {
2685
2723
  this.event("predefine_pageview", n2);
2686
2724
  }, t2;
2687
2725
  }(), q = new R("default");
2726
+ let getRandomValues;
2727
+ const rnds8 = new Uint8Array(16);
2728
+ function rng() {
2729
+ if (!getRandomValues) {
2730
+ getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
2731
+ if (!getRandomValues) {
2732
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
2733
+ }
2734
+ }
2735
+ return getRandomValues(rnds8);
2736
+ }
2737
+ const byteToHex = [];
2738
+ for (let i2 = 0; i2 < 256; ++i2) {
2739
+ byteToHex.push((i2 + 256).toString(16).slice(1));
2740
+ }
2741
+ function unsafeStringify(arr, offset = 0) {
2742
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
2743
+ }
2744
+ const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
2745
+ var native = {
2746
+ randomUUID
2747
+ };
2748
+ function v4(options, buf, offset) {
2749
+ if (native.randomUUID && !buf && !options) {
2750
+ return native.randomUUID();
2751
+ }
2752
+ options = options || {};
2753
+ const rnds = options.random || (options.rng || rng)();
2754
+ rnds[6] = rnds[6] & 15 | 64;
2755
+ rnds[8] = rnds[8] & 63 | 128;
2756
+ if (buf) {
2757
+ offset = offset || 0;
2758
+ for (let i2 = 0; i2 < 16; ++i2) {
2759
+ buf[offset + i2] = rnds[i2];
2760
+ }
2761
+ return buf;
2762
+ }
2763
+ return unsafeStringify(rnds);
2764
+ }
2688
2765
  const DEVICE_ID_KEY = "veplayer_live_device_id";
2689
2766
  const USER_ID_Key = "veplayer_live_user_id";
2690
2767
  const genRandomID = (length) => {
@@ -2710,6 +2787,45 @@ var __publicField = (obj, key, value) => {
2710
2787
  localStorage.setItem(USER_ID_Key, userId);
2711
2788
  return userId;
2712
2789
  };
2790
+ const generateUrlWithSessionId = (url) => {
2791
+ var _a, _b;
2792
+ if (!url) {
2793
+ return "";
2794
+ }
2795
+ const withoutProtocol = url.startsWith("//");
2796
+ if (withoutProtocol) {
2797
+ url = location.protocol + url;
2798
+ }
2799
+ try {
2800
+ const urlObject = new URL(url);
2801
+ if ((_a = urlObject == null ? void 0 : urlObject.searchParams) == null ? void 0 : _a.get("_session_id")) {
2802
+ return url;
2803
+ }
2804
+ (_b = urlObject == null ? void 0 : urlObject.searchParams) == null ? void 0 : _b.append("_session_id", generateSessionId());
2805
+ return urlObject.toString();
2806
+ } catch (error2) {
2807
+ return url;
2808
+ }
2809
+ };
2810
+ const hashCode = (str) => {
2811
+ str += "";
2812
+ let h2 = 0;
2813
+ let off = 0;
2814
+ const len = str.length;
2815
+ for (let i2 = 0; i2 < len; i2++) {
2816
+ h2 = 31 * h2 + str.charCodeAt(off++);
2817
+ if (h2 > 140737488355327 || h2 < -140737488355328) {
2818
+ h2 &= 281474976710655;
2819
+ }
2820
+ }
2821
+ if (h2 < 0) {
2822
+ h2 += 2251799813685247;
2823
+ }
2824
+ return h2;
2825
+ };
2826
+ const generateSessionId = () => {
2827
+ return v4().replace(/-/g, "") + "." + Date.now() + "." + hashCode(v4().replace(/-/g, ""));
2828
+ };
2713
2829
  const Plugin$2 = window["VePlayer"].Plugin;
2714
2830
  const CN_APPID = 468759;
2715
2831
  const CHANNEL = "cn";
@@ -2789,10 +2905,10 @@ var __publicField = (obj, key, value) => {
2789
2905
  user_id: this._userId,
2790
2906
  device_id: this._deviceId,
2791
2907
  ext: {
2792
- veplayer_version: "2.0.0-rc.1",
2793
- flv_version: "3.0.0-next.23",
2794
- hls_version: "3.0.0-next.36-1",
2795
- rts_version: "0.2.0-alpha.3"
2908
+ veplayer_version: "2.1.0-rc.0",
2909
+ flv_version: "3.0.10-alpha.4",
2910
+ hls_version: "3.0.10-alpha.4",
2911
+ rts_version: "0.2.0-alpha.5"
2796
2912
  }
2797
2913
  });
2798
2914
  }
@@ -3077,6 +3193,10 @@ var __publicField = (obj, key, value) => {
3077
3193
  autoplay: { muted: true }
3078
3194
  };
3079
3195
  const LIVE_DEFAULT_PLUGINS = [...DEFAULT_PLUGINS, Refresh, Logger, InfoPanel];
3196
+ var RTMCodec = /* @__PURE__ */ ((RTMCodec2) => {
3197
+ RTMCodec2["H264"] = "h264";
3198
+ return RTMCodec2;
3199
+ })(RTMCodec || {});
3080
3200
  class VePlayerLive extends VePlayerBase {
3081
3201
  /**
3082
3202
  * @hidden
@@ -3116,6 +3236,8 @@ var __publicField = (obj, key, value) => {
3116
3236
  }
3117
3237
  }
3118
3238
  async function createLivePlayer(options) {
3239
+ var _a, _b;
3240
+ let player = void 0;
3119
3241
  if (!options || !options.url && !options.playlist) {
3120
3242
  throw create(ErrorCode.INVALID_PARAMETER, new VeI18n());
3121
3243
  }
@@ -3124,18 +3246,35 @@ var __publicField = (obj, key, value) => {
3124
3246
  ...options,
3125
3247
  plugins: [...LIVE_DEFAULT_PLUGINS, ...options.plugins ?? []]
3126
3248
  };
3127
- const player = await VePlayerBase.create(
3249
+ player = await VePlayerBase.create(
3128
3250
  {
3129
3251
  ...LIVE_DEFAULT_OPTIONS,
3130
3252
  ...finalOptions,
3131
3253
  isLive: true,
3132
3254
  i18nManager: i18n,
3255
+ preProcessUrl: (url) => {
3256
+ return {
3257
+ url: generateUrlWithSessionId(url)
3258
+ };
3259
+ },
3133
3260
  async preparePlugins(url) {
3134
- return getTypeStrategy({ ...finalOptions, url });
3261
+ return getTypeStrategy({ ...finalOptions, url }, player);
3135
3262
  }
3136
3263
  },
3137
3264
  VePlayerLive
3138
3265
  );
3266
+ if (player) {
3267
+ const RTMDegrade = (_b = (_a = player == null ? void 0 : player._player) == null ? void 0 : _a.config) == null ? void 0 : _b._RTMdegrade;
3268
+ if (RTMDegrade) {
3269
+ player.emit("degrade", {
3270
+ originRtmUrl: RTMDegrade._originRtmUrl,
3271
+ code: "NOT_SUPPORT",
3272
+ message: "not support rtm or h264",
3273
+ isRTMSupported: RTMDegrade._isRTMSupported,
3274
+ isRTMSupportCodec: RTMDegrade._isRTMSupportCodec
3275
+ });
3276
+ }
3277
+ }
3139
3278
  return player;
3140
3279
  }
3141
3280
  var live = /* @__PURE__ */ Object.freeze({