@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volcengine/veplayer",
3
- "version": "2.1.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,17 +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
47
  const strategy$1 = window["VePlayer"].strategy;
48
- const util$3 = window["VePlayer"].util;
48
+ const util$4 = window["VePlayer"].util;
49
49
  const DynamicModule$1 = window["VePlayer"].DynamicModule;
50
50
  const load$1 = window["VePlayer"].load;
51
51
  const Codec$1 = window["VePlayer"].Codec;
@@ -65,17 +65,30 @@ var __publicField = (obj, key, value) => {
65
65
  var _a;
66
66
  let backupStrategy;
67
67
  const { url } = options;
68
- const { fallbackUrl, enableFallback = true, ...ret } = options.rtm || {};
68
+ const {
69
+ fallbackUrl,
70
+ enableFallback = true,
71
+ enableRTMAutoTranscode,
72
+ ...ret
73
+ } = options.rtm || {};
69
74
  const actualFallbackUrl = !enableFallback ? "" : !fallbackUrl && url ? generateFallbackUrl(url) : fallbackUrl;
70
- const backupType = actualFallbackUrl && util$3.getStreamType(actualFallbackUrl);
71
- 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)) {
72
77
  backupStrategy = strategy$1.createFlvMseStrategy(options);
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)) {
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)) {
74
79
  backupStrategy = strategy$1.createHlsMseStrategy(options);
75
80
  }
76
81
  const [rtmCdn, backupCdn] = await Promise.all([
77
- load$1(rtmStrategy.module).catch(() => void 0),
78
- 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)
79
92
  ]);
80
93
  const [RTMSupported, RTMSupportCodec] = await Promise.all([
81
94
  isRTMSupported(),
@@ -108,6 +121,7 @@ var __publicField = (obj, key, value) => {
108
121
  return {
109
122
  options: {
110
123
  ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
124
+ url: enableRTMAutoTranscode ? util$4.appendSearchParams(url, { enableRTMAutoTranscode: "true" }) : void 0,
111
125
  _RTMdegrade: void 0,
112
126
  rts: {
113
127
  retryCount: 0,
@@ -119,10 +133,10 @@ var __publicField = (obj, key, value) => {
119
133
  plugins: rtmCdn ? [rtmCdn] : []
120
134
  };
121
135
  };
122
- const util$2 = window["VePlayer"].util;
136
+ const util$3 = window["VePlayer"].util;
123
137
  const strategy = window["VePlayer"].strategy;
124
138
  const getTypeStrategy = async (options, player) => {
125
- const type = options.url ? util$2.getStreamType(options.url) : "";
139
+ const type = options.url ? util$3.getStreamType(options.url) : "";
126
140
  if (!type || type === "unknown") {
127
141
  return { options: {}, plugins: [] };
128
142
  }
@@ -327,7 +341,7 @@ var __publicField = (obj, key, value) => {
327
341
  `;
328
342
  }
329
343
  _handleRefresh(e2) {
330
- var _a, _b, _c;
344
+ var _a, _b, _c, _d, _e, _f;
331
345
  const { player } = this;
332
346
  if (!player)
333
347
  return;
@@ -338,6 +352,7 @@ var __publicField = (obj, key, value) => {
338
352
  if (player) {
339
353
  player.emit(Events.REFRESH_CLICK);
340
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();
341
356
  }
342
357
  player.once(XGEvents.CANPLAY, () => {
343
358
  player.removeClass("xgplayer-is-enter");
@@ -2762,6 +2777,7 @@ var __publicField = (obj, key, value) => {
2762
2777
  }
2763
2778
  return unsafeStringify(rnds);
2764
2779
  }
2780
+ const util$2 = window["VePlayer"].util;
2765
2781
  const DEVICE_ID_KEY = "veplayer_live_device_id";
2766
2782
  const USER_ID_Key = "veplayer_live_user_id";
2767
2783
  const genRandomID = (length) => {
@@ -2788,24 +2804,12 @@ var __publicField = (obj, key, value) => {
2788
2804
  return userId;
2789
2805
  };
2790
2806
  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
- (_b = urlObject == null ? void 0 : urlObject.searchParams) == null ? void 0 : _b.append("_session_id", generateSessionId());
2803
- }
2804
- url = urlObject.toString();
2805
- } catch (error2) {
2807
+ const urlObject = util$2.getUrlObject(url);
2808
+ if (!urlObject) {
2809
+ return url ?? "";
2806
2810
  }
2807
- if (withoutProtocol) {
2808
- return url == null ? void 0 : url.replace(location.protocol, "");
2811
+ if (!(urlObject == null ? void 0 : urlObject.searchParams.get("_session_id"))) {
2812
+ return util$2.appendSearchParams(url, { _session_id: generateSessionId() });
2809
2813
  }
2810
2814
  return url;
2811
2815
  };
@@ -2907,9 +2911,9 @@ var __publicField = (obj, key, value) => {
2907
2911
  user_id: this._userId,
2908
2912
  device_id: this._deviceId,
2909
2913
  ext: {
2910
- veplayer_version: "2.1.0",
2911
- flv_version: "3.0.10-alpha.4",
2912
- hls_version: "3.0.10-alpha.4",
2914
+ veplayer_version: "2.2.0-rc.0",
2915
+ flv_version: "3.0.11-alpha.2",
2916
+ hls_version: "3.0.11-alpha.2",
2913
2917
  rts_version: "0.2.0-alpha.5"
2914
2918
  }
2915
2919
  });