@volcengine/veplayer 2.1.0 → 2.2.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 (40) hide show
  1. package/esm/index.d.ts +2 -6
  2. package/esm/veplayer.biz.live.development.js +38 -34
  3. package/esm/veplayer.biz.live.production.js +1 -1
  4. package/esm/veplayer.d.ts +34 -10
  5. package/esm/veplayer.development.css +1 -1
  6. package/esm/veplayer.development.js +156 -61
  7. package/esm/veplayer.live.d.ts +34 -10
  8. package/esm/veplayer.live.development.css +1 -1
  9. package/esm/veplayer.live.development.js +156 -61
  10. package/esm/veplayer.live.production.css +1 -1
  11. package/esm/veplayer.live.production.js +3 -3
  12. package/esm/veplayer.production.css +1 -1
  13. package/esm/veplayer.production.js +3 -3
  14. package/esm/veplayer.vod.d.ts +2 -6
  15. package/esm/veplayer.vod.development.css +1 -1
  16. package/esm/veplayer.vod.development.js +94 -19
  17. package/esm/veplayer.vod.production.css +1 -1
  18. package/esm/veplayer.vod.production.js +2 -2
  19. package/package.json +2 -1
  20. package/umd/index.d.ts +2 -6
  21. package/umd/veplayer.biz.live.development.js +38 -34
  22. package/umd/veplayer.biz.live.production.js +1 -1
  23. package/umd/veplayer.d.ts +34 -10
  24. package/umd/veplayer.development.css +1 -1
  25. package/umd/veplayer.development.js +156 -61
  26. package/umd/veplayer.live.d.ts +34 -10
  27. package/umd/veplayer.live.development.css +1 -1
  28. package/umd/veplayer.live.development.js +156 -61
  29. package/umd/veplayer.live.production.css +1 -1
  30. package/umd/veplayer.live.production.js +1 -1
  31. package/umd/veplayer.production.css +1 -1
  32. package/umd/veplayer.production.js +1 -1
  33. package/umd/veplayer.vod.d.ts +2 -6
  34. package/umd/veplayer.vod.development.css +1 -1
  35. package/umd/veplayer.vod.development.js +94 -19
  36. package/umd/veplayer.vod.production.css +1 -1
  37. package/umd/veplayer.vod.production.js +1 -1
  38. package/veplayer.d.ts +6772 -0
  39. package/veplayer.live.d.ts +6774 -0
  40. package/veplayer.vod.d.ts +3171 -0
package/esm/index.d.ts CHANGED
@@ -2662,18 +2662,14 @@ declare namespace strategy {
2662
2662
  plugins?: undefined;
2663
2663
  } | {
2664
2664
  options: Partial<VePlayerBaseOptions>;
2665
- plugins: {
2666
- [x: string]: any;
2667
- }[];
2665
+ plugins: any[];
2668
2666
  }>;
2669
2667
  const getHlsStrategy: (options: VePlayerBaseOptions) => Promise<{
2670
2668
  options?: undefined;
2671
2669
  plugins?: undefined;
2672
2670
  } | {
2673
2671
  options: Partial<VePlayerBaseOptions>;
2674
- plugins: {
2675
- [x: string]: any;
2676
- }[];
2672
+ plugins: any[];
2677
2673
  }>;
2678
2674
  }
2679
2675
  declare namespace error {
@@ -31,17 +31,17 @@ function create(errorCode, i18n) {
31
31
  const DynamicModule$2 = window["VePlayer"].DynamicModule;
32
32
  const load$2 = window["VePlayer"].load;
33
33
  async function isRTMSupported() {
34
- const Rtm = await load$2(DynamicModule$2.PluginRtm);
35
- return Rtm.isSupported();
34
+ const { RtmPlugin } = await load$2(DynamicModule$2.PluginRtm);
35
+ return RtmPlugin.isSupported();
36
36
  }
37
37
  async function isRTMSupportCodec(codec = RTMCodec.H264) {
38
- const Rtm = await load$2(DynamicModule$2.PluginRtm);
38
+ const { RtmPlugin } = await load$2(DynamicModule$2.PluginRtm);
39
39
  if (codec === RTMCodec.H264)
40
- return Rtm.isSupportedH264();
40
+ return RtmPlugin.isSupportedH264();
41
41
  return false;
42
42
  }
43
43
  const strategy$1 = window["VePlayer"].strategy;
44
- const util$3 = window["VePlayer"].util;
44
+ const util$4 = window["VePlayer"].util;
45
45
  const DynamicModule$1 = window["VePlayer"].DynamicModule;
46
46
  const load$1 = window["VePlayer"].load;
47
47
  const Codec$1 = window["VePlayer"].Codec;
@@ -61,17 +61,30 @@ const getRtmStrategy = async (options, player) => {
61
61
  var _a;
62
62
  let backupStrategy;
63
63
  const { url } = options;
64
- const { fallbackUrl, enableFallback = true, ...ret } = options.rtm || {};
64
+ const {
65
+ fallbackUrl,
66
+ enableFallback = true,
67
+ enableRTMAutoTranscode,
68
+ ...ret
69
+ } = options.rtm || {};
65
70
  const actualFallbackUrl = !enableFallback ? "" : !fallbackUrl && url ? generateFallbackUrl(url) : fallbackUrl;
66
- const backupType = actualFallbackUrl && util$3.getStreamType(actualFallbackUrl);
67
- if (backupType === "flv" && util$3.isMseSupported(Codec$1.H264)) {
71
+ const backupType = actualFallbackUrl && util$4.getStreamType(actualFallbackUrl);
72
+ if (backupType === "flv" && util$4.isMseSupported(Codec$1.H264)) {
68
73
  backupStrategy = strategy$1.createFlvMseStrategy(options);
69
- } 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)) {
74
+ } else if (backupType === "hls" && (Sniffer$2.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && util$4.isMseSupported(Codec$1.H264)) {
70
75
  backupStrategy = strategy$1.createHlsMseStrategy(options);
71
76
  }
72
77
  const [rtmCdn, backupCdn] = await Promise.all([
73
- load$1(rtmStrategy.module).catch(() => void 0),
74
- backupStrategy && load$1(backupStrategy.module).catch(() => void 0)
78
+ load$1(rtmStrategy.module).then((module) => {
79
+ return module.RtmPlugin;
80
+ }).catch(() => void 0),
81
+ backupStrategy && load$1(backupStrategy.module).then((module) => {
82
+ if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$1.PluginFlv) {
83
+ return module.FlvPlugin;
84
+ } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$1.PluginHls) {
85
+ return module.HlsPlugin;
86
+ }
87
+ }).catch(() => void 0)
75
88
  ]);
76
89
  const [RTMSupported, RTMSupportCodec] = await Promise.all([
77
90
  isRTMSupported(),
@@ -104,6 +117,7 @@ const getRtmStrategy = async (options, player) => {
104
117
  return {
105
118
  options: {
106
119
  ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
120
+ url: enableRTMAutoTranscode ? util$4.appendSearchParams(url, { enableRTMAutoTranscode: "true" }) : void 0,
107
121
  _RTMdegrade: void 0,
108
122
  rts: {
109
123
  retryCount: 0,
@@ -115,10 +129,10 @@ const getRtmStrategy = async (options, player) => {
115
129
  plugins: rtmCdn ? [rtmCdn] : []
116
130
  };
117
131
  };
118
- const util$2 = window["VePlayer"].util;
132
+ const util$3 = window["VePlayer"].util;
119
133
  const strategy = window["VePlayer"].strategy;
120
134
  const getTypeStrategy = async (options, player) => {
121
- const type = options.url ? util$2.getStreamType(options.url) : "";
135
+ const type = options.url ? util$3.getStreamType(options.url) : "";
122
136
  if (!type || type === "unknown") {
123
137
  return { options: {}, plugins: [] };
124
138
  }
@@ -323,7 +337,7 @@ class Refresh extends Plugin$3 {
323
337
  `;
324
338
  }
325
339
  _handleRefresh(e3) {
326
- var _a, _b, _c;
340
+ var _a, _b, _c, _d, _e, _f;
327
341
  const { player } = this;
328
342
  if (!player)
329
343
  return;
@@ -334,6 +348,7 @@ class Refresh extends Plugin$3 {
334
348
  if (player) {
335
349
  player.emit(Events.REFRESH_CLICK);
336
350
  (_c = (_b = (_a = this.player) == null ? void 0 : _a.config) == null ? void 0 : _b.veplayer) == null ? void 0 : _c.retry();
351
+ (_f = (_e = (_d = this.player) == null ? void 0 : _d.plugins) == null ? void 0 : _e.error) == null ? void 0 : _f.hideError();
337
352
  }
338
353
  player.once(XGEvents.CANPLAY, () => {
339
354
  player.removeClass("xgplayer-is-enter");
@@ -2758,6 +2773,7 @@ function v4(options, buf, offset) {
2758
2773
  }
2759
2774
  return unsafeStringify(rnds);
2760
2775
  }
2776
+ const util$2 = window["VePlayer"].util;
2761
2777
  const DEVICE_ID_KEY = "veplayer_live_device_id";
2762
2778
  const USER_ID_Key = "veplayer_live_user_id";
2763
2779
  const genRandomID2 = (length) => {
@@ -2784,24 +2800,12 @@ const getUserId2 = () => {
2784
2800
  return userId;
2785
2801
  };
2786
2802
  const generateUrlWithSessionId = (url) => {
2787
- var _a, _b;
2788
- if (!url) {
2789
- return "";
2790
- }
2791
- const withoutProtocol = url.startsWith("//");
2792
- if (withoutProtocol) {
2793
- url = location.protocol + url;
2794
- }
2795
- try {
2796
- const urlObject = new URL(url);
2797
- if (!((_a = urlObject == null ? void 0 : urlObject.searchParams) == null ? void 0 : _a.get("_session_id"))) {
2798
- (_b = urlObject == null ? void 0 : urlObject.searchParams) == null ? void 0 : _b.append("_session_id", generateSessionId());
2799
- }
2800
- url = urlObject.toString();
2801
- } catch (error2) {
2803
+ const urlObject = util$2.getUrlObject(url);
2804
+ if (!urlObject) {
2805
+ return url ?? "";
2802
2806
  }
2803
- if (withoutProtocol) {
2804
- return url == null ? void 0 : url.replace(location.protocol, "");
2807
+ if (!(urlObject == null ? void 0 : urlObject.searchParams.get("_session_id"))) {
2808
+ return util$2.appendSearchParams(url, { _session_id: generateSessionId() });
2805
2809
  }
2806
2810
  return url;
2807
2811
  };
@@ -2903,9 +2907,9 @@ class Logger extends Plugin$2 {
2903
2907
  user_id: this._userId,
2904
2908
  device_id: this._deviceId,
2905
2909
  ext: {
2906
- veplayer_version: "2.1.0",
2907
- flv_version: "3.0.10-alpha.4",
2908
- hls_version: "3.0.10-alpha.4",
2910
+ veplayer_version: "2.2.0-rc.0",
2911
+ flv_version: "3.0.11-alpha.2",
2912
+ hls_version: "3.0.11-alpha.2",
2909
2913
  rts_version: "0.2.0-alpha.5"
2910
2914
  }
2911
2915
  });