@volcengine/veplayer 2.2.0-rc.0 → 2.2.0-rc.2

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 +28 -53
  3. package/esm/veplayer.biz.live.production.js +1 -1
  4. package/esm/veplayer.d.ts +16 -10
  5. package/esm/veplayer.development.css +1 -1
  6. package/esm/veplayer.development.js +147 -81
  7. package/esm/veplayer.live.d.ts +16 -10
  8. package/esm/veplayer.live.development.css +1 -1
  9. package/esm/veplayer.live.development.js +147 -81
  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 +28 -53
  22. package/umd/veplayer.biz.live.production.js +1 -1
  23. package/umd/veplayer.d.ts +16 -10
  24. package/umd/veplayer.development.css +1 -1
  25. package/umd/veplayer.development.js +147 -81
  26. package/umd/veplayer.live.d.ts +16 -10
  27. package/umd/veplayer.live.development.css +1 -1
  28. package/umd/veplayer.live.development.js +147 -81
  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,52 +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
- const appendSearchParams = (url, searchParams) => {
44
- var _a, _b;
45
- const urlObject = getUrlObject(url);
46
- if (!url || !urlObject) {
47
- return url ?? "";
48
- }
49
- const withoutProtocol = url.startsWith("//");
50
- for (const key in searchParams) {
51
- const value = searchParams[key];
52
- if (urlObject == null ? void 0 : urlObject.searchParams.has(key)) {
53
- (_a = urlObject == null ? void 0 : urlObject.searchParams) == null ? void 0 : _a.set(key, value);
54
- } else {
55
- (_b = urlObject == null ? void 0 : urlObject.searchParams) == null ? void 0 : _b.append(key, value);
56
- }
57
- }
58
- url = urlObject.toString();
59
- if (withoutProtocol) {
60
- return url == null ? void 0 : url.replace(location.protocol, "");
61
- }
62
- return url;
63
- };
64
- const getUrlObject = (url) => {
65
- if (!url) {
66
- return;
67
- }
68
- const withoutProtocol = url.startsWith("//");
69
- if (withoutProtocol) {
70
- url = location.protocol + url;
71
- }
72
- try {
73
- return new URL(url);
74
- } catch (error2) {
75
- return;
76
- }
77
- };
78
43
  const strategy$1 = window["VePlayer"].strategy;
79
- const util$3 = window["VePlayer"].util;
44
+ const util$4 = window["VePlayer"].util;
80
45
  const DynamicModule$1 = window["VePlayer"].DynamicModule;
81
46
  const load$1 = window["VePlayer"].load;
82
47
  const Codec$1 = window["VePlayer"].Codec;
@@ -103,15 +68,23 @@ const getRtmStrategy = async (options, player) => {
103
68
  ...ret
104
69
  } = options.rtm || {};
105
70
  const actualFallbackUrl = !enableFallback ? "" : !fallbackUrl && url ? generateFallbackUrl(url) : fallbackUrl;
106
- const backupType = actualFallbackUrl && util$3.getStreamType(actualFallbackUrl);
107
- 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)) {
108
73
  backupStrategy = strategy$1.createFlvMseStrategy(options);
109
- } 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)) {
110
75
  backupStrategy = strategy$1.createHlsMseStrategy(options);
111
76
  }
112
77
  const [rtmCdn, backupCdn] = await Promise.all([
113
- load$1(rtmStrategy.module).catch(() => void 0),
114
- 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)
115
88
  ]);
116
89
  const [RTMSupported, RTMSupportCodec] = await Promise.all([
117
90
  isRTMSupported(),
@@ -144,7 +117,7 @@ const getRtmStrategy = async (options, player) => {
144
117
  return {
145
118
  options: {
146
119
  ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
147
- url: enableRTMAutoTranscode ? appendSearchParams(url, { enableRTMAutoTranscode: "true" }) : void 0,
120
+ url: enableRTMAutoTranscode ? util$4.appendSearchParams(url, { enableRTMAutoTranscode: "true" }) : void 0,
148
121
  _RTMdegrade: void 0,
149
122
  rts: {
150
123
  retryCount: 0,
@@ -156,10 +129,10 @@ const getRtmStrategy = async (options, player) => {
156
129
  plugins: rtmCdn ? [rtmCdn] : []
157
130
  };
158
131
  };
159
- const util$2 = window["VePlayer"].util;
132
+ const util$3 = window["VePlayer"].util;
160
133
  const strategy = window["VePlayer"].strategy;
161
134
  const getTypeStrategy = async (options, player) => {
162
- const type = options.url ? util$2.getStreamType(options.url) : "";
135
+ const type = options.url ? util$3.getStreamType(options.url) : "";
163
136
  if (!type || type === "unknown") {
164
137
  return { options: {}, plugins: [] };
165
138
  }
@@ -364,7 +337,7 @@ class Refresh extends Plugin$3 {
364
337
  `;
365
338
  }
366
339
  _handleRefresh(e3) {
367
- var _a, _b, _c;
340
+ var _a, _b, _c, _d, _e, _f;
368
341
  const { player } = this;
369
342
  if (!player)
370
343
  return;
@@ -375,6 +348,7 @@ class Refresh extends Plugin$3 {
375
348
  if (player) {
376
349
  player.emit(Events.REFRESH_CLICK);
377
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();
378
352
  }
379
353
  player.once(XGEvents.CANPLAY, () => {
380
354
  player.removeClass("xgplayer-is-enter");
@@ -2799,6 +2773,7 @@ function v4(options, buf, offset) {
2799
2773
  }
2800
2774
  return unsafeStringify(rnds);
2801
2775
  }
2776
+ const util$2 = window["VePlayer"].util;
2802
2777
  const DEVICE_ID_KEY = "veplayer_live_device_id";
2803
2778
  const USER_ID_Key = "veplayer_live_user_id";
2804
2779
  const genRandomID2 = (length) => {
@@ -2825,12 +2800,12 @@ const getUserId2 = () => {
2825
2800
  return userId;
2826
2801
  };
2827
2802
  const generateUrlWithSessionId = (url) => {
2828
- const urlObject = getUrlObject(url);
2803
+ const urlObject = util$2.getUrlObject(url);
2829
2804
  if (!urlObject) {
2830
2805
  return url ?? "";
2831
2806
  }
2832
2807
  if (!(urlObject == null ? void 0 : urlObject.searchParams.get("_session_id"))) {
2833
- return appendSearchParams(url, { _session_id: generateSessionId() });
2808
+ return util$2.appendSearchParams(url, { _session_id: generateSessionId() });
2834
2809
  }
2835
2810
  return url;
2836
2811
  };
@@ -2933,8 +2908,8 @@ class Logger extends Plugin$2 {
2933
2908
  device_id: this._deviceId,
2934
2909
  ext: {
2935
2910
  veplayer_version: "2.2.0-rc.0",
2936
- flv_version: "3.0.10-alpha.4",
2937
- hls_version: "3.0.10-alpha.4",
2911
+ flv_version: "3.0.11-alpha.2",
2912
+ hls_version: "3.0.11-alpha.2",
2938
2913
  rts_version: "0.2.0-alpha.5"
2939
2914
  }
2940
2915
  });