@volcengine/veplayer 2.2.0-rc.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 +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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volcengine/veplayer",
3
- "version": "2.2.0-rc.0",
3
+ "version": "2.2.0-rc.1",
4
4
  "main": "./umd/veplayer.production.js",
5
5
  "module": "./esm/veplayer.production.js",
6
6
  "browser": "./umd/veplayer.production.js",
@@ -77,6 +77,7 @@
77
77
  "files": [
78
78
  "esm",
79
79
  "umd",
80
+ "*.d.ts",
80
81
  "!**/*.map"
81
82
  ]
82
83
  }
package/umd/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 {
@@ -35,52 +35,17 @@ var __publicField = (obj, key, value) => {
35
35
  const DynamicModule$2 = window["VePlayer"].DynamicModule;
36
36
  const load$2 = window["VePlayer"].load;
37
37
  async function isRTMSupported() {
38
- const Rtm = await load$2(DynamicModule$2.PluginRtm);
39
- return Rtm.isSupported();
38
+ const { RtmPlugin } = await load$2(DynamicModule$2.PluginRtm);
39
+ return RtmPlugin.isSupported();
40
40
  }
41
41
  async function isRTMSupportCodec(codec = RTMCodec.H264) {
42
- const Rtm = await load$2(DynamicModule$2.PluginRtm);
42
+ const { RtmPlugin } = await load$2(DynamicModule$2.PluginRtm);
43
43
  if (codec === RTMCodec.H264)
44
- return Rtm.isSupportedH264();
44
+ return RtmPlugin.isSupportedH264();
45
45
  return false;
46
46
  }
47
- const appendSearchParams = (url, searchParams) => {
48
- var _a, _b;
49
- const urlObject = getUrlObject(url);
50
- if (!url || !urlObject) {
51
- return url ?? "";
52
- }
53
- const withoutProtocol = url.startsWith("//");
54
- for (const key in searchParams) {
55
- const value = searchParams[key];
56
- if (urlObject == null ? void 0 : urlObject.searchParams.has(key)) {
57
- (_a = urlObject == null ? void 0 : urlObject.searchParams) == null ? void 0 : _a.set(key, value);
58
- } else {
59
- (_b = urlObject == null ? void 0 : urlObject.searchParams) == null ? void 0 : _b.append(key, value);
60
- }
61
- }
62
- url = urlObject.toString();
63
- if (withoutProtocol) {
64
- return url == null ? void 0 : url.replace(location.protocol, "");
65
- }
66
- return url;
67
- };
68
- const getUrlObject = (url) => {
69
- if (!url) {
70
- return;
71
- }
72
- const withoutProtocol = url.startsWith("//");
73
- if (withoutProtocol) {
74
- url = location.protocol + url;
75
- }
76
- try {
77
- return new URL(url);
78
- } catch (error2) {
79
- return;
80
- }
81
- };
82
47
  const strategy$1 = window["VePlayer"].strategy;
83
- const util$3 = window["VePlayer"].util;
48
+ const util$4 = window["VePlayer"].util;
84
49
  const DynamicModule$1 = window["VePlayer"].DynamicModule;
85
50
  const load$1 = window["VePlayer"].load;
86
51
  const Codec$1 = window["VePlayer"].Codec;
@@ -107,15 +72,23 @@ var __publicField = (obj, key, value) => {
107
72
  ...ret
108
73
  } = options.rtm || {};
109
74
  const actualFallbackUrl = !enableFallback ? "" : !fallbackUrl && url ? generateFallbackUrl(url) : fallbackUrl;
110
- const backupType = actualFallbackUrl && util$3.getStreamType(actualFallbackUrl);
111
- if (backupType === "flv" && util$3.isMseSupported(Codec$1.H264)) {
75
+ const backupType = actualFallbackUrl && util$4.getStreamType(actualFallbackUrl);
76
+ if (backupType === "flv" && util$4.isMseSupported(Codec$1.H264)) {
112
77
  backupStrategy = strategy$1.createFlvMseStrategy(options);
113
- } 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)) {
78
+ } 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)) {
114
79
  backupStrategy = strategy$1.createHlsMseStrategy(options);
115
80
  }
116
81
  const [rtmCdn, backupCdn] = await Promise.all([
117
- load$1(rtmStrategy.module).catch(() => void 0),
118
- backupStrategy && load$1(backupStrategy.module).catch(() => void 0)
82
+ load$1(rtmStrategy.module).then((module2) => {
83
+ return module2.RtmPlugin;
84
+ }).catch(() => void 0),
85
+ backupStrategy && load$1(backupStrategy.module).then((module2) => {
86
+ if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$1.PluginFlv) {
87
+ return module2.FlvPlugin;
88
+ } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$1.PluginHls) {
89
+ return module2.HlsPlugin;
90
+ }
91
+ }).catch(() => void 0)
119
92
  ]);
120
93
  const [RTMSupported, RTMSupportCodec] = await Promise.all([
121
94
  isRTMSupported(),
@@ -148,7 +121,7 @@ var __publicField = (obj, key, value) => {
148
121
  return {
149
122
  options: {
150
123
  ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
151
- url: enableRTMAutoTranscode ? appendSearchParams(url, { enableRTMAutoTranscode: "true" }) : void 0,
124
+ url: enableRTMAutoTranscode ? util$4.appendSearchParams(url, { enableRTMAutoTranscode: "true" }) : void 0,
152
125
  _RTMdegrade: void 0,
153
126
  rts: {
154
127
  retryCount: 0,
@@ -160,10 +133,10 @@ var __publicField = (obj, key, value) => {
160
133
  plugins: rtmCdn ? [rtmCdn] : []
161
134
  };
162
135
  };
163
- const util$2 = window["VePlayer"].util;
136
+ const util$3 = window["VePlayer"].util;
164
137
  const strategy = window["VePlayer"].strategy;
165
138
  const getTypeStrategy = async (options, player) => {
166
- const type = options.url ? util$2.getStreamType(options.url) : "";
139
+ const type = options.url ? util$3.getStreamType(options.url) : "";
167
140
  if (!type || type === "unknown") {
168
141
  return { options: {}, plugins: [] };
169
142
  }
@@ -368,7 +341,7 @@ var __publicField = (obj, key, value) => {
368
341
  `;
369
342
  }
370
343
  _handleRefresh(e2) {
371
- var _a, _b, _c;
344
+ var _a, _b, _c, _d, _e, _f;
372
345
  const { player } = this;
373
346
  if (!player)
374
347
  return;
@@ -379,6 +352,7 @@ var __publicField = (obj, key, value) => {
379
352
  if (player) {
380
353
  player.emit(Events.REFRESH_CLICK);
381
354
  (_c = (_b = (_a = this.player) == null ? void 0 : _a.config) == null ? void 0 : _b.veplayer) == null ? void 0 : _c.retry();
355
+ (_f = (_e = (_d = this.player) == null ? void 0 : _d.plugins) == null ? void 0 : _e.error) == null ? void 0 : _f.hideError();
382
356
  }
383
357
  player.once(XGEvents.CANPLAY, () => {
384
358
  player.removeClass("xgplayer-is-enter");
@@ -2803,6 +2777,7 @@ var __publicField = (obj, key, value) => {
2803
2777
  }
2804
2778
  return unsafeStringify(rnds);
2805
2779
  }
2780
+ const util$2 = window["VePlayer"].util;
2806
2781
  const DEVICE_ID_KEY = "veplayer_live_device_id";
2807
2782
  const USER_ID_Key = "veplayer_live_user_id";
2808
2783
  const genRandomID = (length) => {
@@ -2829,12 +2804,12 @@ var __publicField = (obj, key, value) => {
2829
2804
  return userId;
2830
2805
  };
2831
2806
  const generateUrlWithSessionId = (url) => {
2832
- const urlObject = getUrlObject(url);
2807
+ const urlObject = util$2.getUrlObject(url);
2833
2808
  if (!urlObject) {
2834
2809
  return url ?? "";
2835
2810
  }
2836
2811
  if (!(urlObject == null ? void 0 : urlObject.searchParams.get("_session_id"))) {
2837
- return appendSearchParams(url, { _session_id: generateSessionId() });
2812
+ return util$2.appendSearchParams(url, { _session_id: generateSessionId() });
2838
2813
  }
2839
2814
  return url;
2840
2815
  };
@@ -2937,8 +2912,8 @@ var __publicField = (obj, key, value) => {
2937
2912
  device_id: this._deviceId,
2938
2913
  ext: {
2939
2914
  veplayer_version: "2.2.0-rc.0",
2940
- flv_version: "3.0.10-alpha.4",
2941
- hls_version: "3.0.10-alpha.4",
2915
+ flv_version: "3.0.11-alpha.2",
2916
+ hls_version: "3.0.11-alpha.2",
2942
2917
  rts_version: "0.2.0-alpha.5"
2943
2918
  }
2944
2919
  });