@volcengine/veplayer 2.4.0-rc.5 → 2.4.1-rc.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volcengine/veplayer",
3
- "version": "2.4.0-rc.5",
3
+ "version": "2.4.1-rc.0",
4
4
  "main": "./umd/veplayer.production.js",
5
5
  "module": "./esm/veplayer.production.js",
6
6
  "browser": "./umd/veplayer.production.js",
@@ -44,15 +44,72 @@ var __publicField = (obj, key, value) => {
44
44
  return RtmPlugin.isSupportedH264();
45
45
  return false;
46
46
  }
47
- const strategy$1 = window["VePlayer"].strategy;
48
- const util$4 = window["VePlayer"].util;
47
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
48
+ function getDefaultExportFromCjs(x2) {
49
+ return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
50
+ }
51
+ function isType(suffix) {
52
+ return function(url) {
53
+ return url == null ? void 0 : url.split("?")[0].toLowerCase().includes(suffix);
54
+ };
55
+ }
56
+ const isHls = isType(".m3u8");
57
+ const isMp4 = isType(".mp4");
58
+ const isFlv = isType(".flv");
59
+ const isRtm = isType(".sdp");
60
+ const isDash = isType(".mpd");
61
+ function getStreamType(url) {
62
+ if (isHls(url)) {
63
+ return "hls";
64
+ }
65
+ if (isFlv(url)) {
66
+ return "flv";
67
+ }
68
+ if (isRtm(url)) {
69
+ return "rtm";
70
+ }
71
+ if (isMp4(url)) {
72
+ return "mp4";
73
+ }
74
+ if (isDash(url)) {
75
+ return "dash";
76
+ }
77
+ return "unknown";
78
+ }
49
79
  const DynamicModule$3 = window["VePlayer"].DynamicModule;
50
80
  const load$3 = window["VePlayer"].load;
81
+ const getAbrStrategy = async (options) => {
82
+ var _a, _b;
83
+ const streamType = options.url && getStreamType(options.url);
84
+ if (streamType === "rtm") {
85
+ return {};
86
+ }
87
+ const abrOptions = streamType === "flv" ? (_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.abr : (_b = options == null ? void 0 : options.hls) == null ? void 0 : _b.abr;
88
+ if (!abrOptions) {
89
+ return {};
90
+ }
91
+ const abrPlugin = await load$3(DynamicModule$3.PluginAbr).catch(() => void 0);
92
+ return {
93
+ options: {
94
+ [streamType === "flv" ? "abr" : "hlsabr"]: {
95
+ ...abrOptions,
96
+ open: abrOptions.enable ?? true
97
+ }
98
+ },
99
+ plugins: [
100
+ streamType === "flv" ? abrPlugin == null ? void 0 : abrPlugin.AbrPlugin : abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin
101
+ ]
102
+ };
103
+ };
104
+ const strategy$1 = window["VePlayer"].strategy;
105
+ const util$4 = window["VePlayer"].util;
106
+ const DynamicModule$2 = window["VePlayer"].DynamicModule;
107
+ const load$2 = window["VePlayer"].load;
51
108
  const Codec$1 = window["VePlayer"].Codec;
52
109
  const Sniffer$3 = window["VePlayer"].Sniffer;
53
110
  const rtmStrategy = {
54
111
  options: {},
55
- module: DynamicModule$3.PluginRtm
112
+ module: DynamicModule$2.PluginRtm
56
113
  };
57
114
  const generateFallbackUrl = (url) => {
58
115
  if (Sniffer$3.device === "pc") {
@@ -64,6 +121,8 @@ var __publicField = (obj, key, value) => {
64
121
  const getRtmStrategy = async (options, player) => {
65
122
  var _a;
66
123
  let backupStrategy;
124
+ let backupOptions = {};
125
+ let backupModule = [];
67
126
  const { url } = options;
68
127
  const {
69
128
  fallbackUrl,
@@ -78,18 +137,28 @@ var __publicField = (obj, key, value) => {
78
137
  } else if (backupType === "hls" && (Sniffer$3.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && util$4.isMseSupported(Codec$1.H264)) {
79
138
  backupStrategy = strategy$1.createHlsMseStrategy(options);
80
139
  }
81
- const [rtmCdn, backupCdn] = await Promise.all([
82
- load$3(rtmStrategy.module).then((module2) => {
140
+ const [rtmCdn, backupCdn, backupAbr] = await Promise.all([
141
+ load$2(rtmStrategy.module).then((module2) => {
83
142
  return module2.RtmPlugin;
84
143
  }).catch(() => void 0),
85
- backupStrategy && load$3(backupStrategy.module).then((module2) => {
86
- if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginFlv) {
144
+ backupStrategy && load$2(backupStrategy.module).then((module2) => {
145
+ if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.PluginFlv) {
87
146
  return module2.FlvPlugin;
88
- } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginHls) {
147
+ } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.PluginHls) {
89
148
  return module2.HlsPlugin;
90
149
  }
91
- }).catch(() => void 0)
150
+ }).catch(() => void 0),
151
+ getAbrStrategy({ ...options, url: actualFallbackUrl }).catch(
152
+ () => void 0
153
+ )
92
154
  ]);
155
+ if (backupType) {
156
+ backupOptions = {
157
+ ...backupStrategy == null ? void 0 : backupStrategy.options,
158
+ ...backupAbr == null ? void 0 : backupAbr.options
159
+ };
160
+ backupModule = [backupCdn, ...(backupAbr == null ? void 0 : backupAbr.plugins) ?? []];
161
+ }
93
162
  const [RTMSupported, RTMSupportCodec] = await Promise.all([
94
163
  isRTMSupported(),
95
164
  isRTMSupportCodec()
@@ -107,7 +176,7 @@ var __publicField = (obj, key, value) => {
107
176
  }
108
177
  return {
109
178
  options: {
110
- ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
179
+ ...backupOptions || {},
111
180
  url: actualFallbackUrl,
112
181
  _RTMdegrade: {
113
182
  _originRtmUrl: url,
@@ -115,19 +184,19 @@ var __publicField = (obj, key, value) => {
115
184
  _isRTMSupportCodec: RTMSupportCodec
116
185
  }
117
186
  },
118
- plugins: backupCdn ? [backupCdn] : []
187
+ plugins: backupModule
119
188
  };
120
189
  }
121
190
  return {
122
191
  options: {
123
- ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
192
+ ...backupOptions || {},
124
193
  url: enableRTMAutoTranscode ? util$4.appendSearchParams(url, { enableRTMAutoTranscode: "true" }) : void 0,
125
194
  _RTMdegrade: void 0,
126
195
  rts: {
127
196
  retryCount: 0,
128
197
  ...ret,
129
198
  backupURL: actualFallbackUrl,
130
- backupConstruct: backupCdn
199
+ backupConstruct: backupModule
131
200
  }
132
201
  },
133
202
  plugins: rtmCdn ? [rtmCdn] : []
@@ -178,10 +247,6 @@ var __publicField = (obj, key, value) => {
178
247
  }
179
248
  return { options: {}, plugins: [] };
180
249
  };
181
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
182
- function getDefaultExportFromCjs(x2) {
183
- return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
184
- }
185
250
  var FUNC_ERROR_TEXT = "Expected a function";
186
251
  var NAN = 0 / 0;
187
252
  var symbolTag = "[object Symbol]";
@@ -2994,10 +3059,10 @@ var __publicField = (obj, key, value) => {
2994
3059
  user_id: this._userId,
2995
3060
  device_id: this._deviceId,
2996
3061
  ext: {
2997
- veplayer_version: "2.3.1-rc.0",
2998
- flv_version: "3.0.19-rc.0",
3062
+ veplayer_version: "2.3.1-rc.1",
3063
+ flv_version: "3.0.19-rc.10",
2999
3064
  hls_version: "3.0.19-rc.0",
3000
- rts_version: "0.2.1-alpha.0"
3065
+ rts_version: "0.2.1-alpha.1"
3001
3066
  }
3002
3067
  });
3003
3068
  }
@@ -3265,8 +3330,8 @@ var __publicField = (obj, key, value) => {
3265
3330
  DECODE_INFO: "软解信息",
3266
3331
  REFRESH: "刷新"
3267
3332
  };
3268
- const DynamicModule$2 = window["VePlayer"].DynamicModule;
3269
- const load$2 = window["VePlayer"].load;
3333
+ const DynamicModule$1 = window["VePlayer"].DynamicModule;
3334
+ const load$1 = window["VePlayer"].load;
3270
3335
  const getDrmStrategy = async (options, player) => {
3271
3336
  var _a;
3272
3337
  const drmType = getDrmType(options.drm);
@@ -3274,7 +3339,7 @@ var __publicField = (obj, key, value) => {
3274
3339
  try {
3275
3340
  const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
3276
3341
  const [drmPlugin, drmConfig] = await Promise.all([
3277
- load$2(DynamicModule$2.PluginDrm).then((module2) => module2.DrmPlugin).catch(() => void 0),
3342
+ load$1(DynamicModule$1.PluginDrm).then((module2) => module2.DrmPlugin).catch(() => void 0),
3278
3343
  getDrmConfig == null ? void 0 : getDrmConfig({
3279
3344
  url: options.url
3280
3345
  })
@@ -3298,59 +3363,6 @@ var __publicField = (obj, key, value) => {
3298
3363
  }
3299
3364
  return {};
3300
3365
  };
3301
- function isType(suffix) {
3302
- return function(url) {
3303
- return url == null ? void 0 : url.split("?")[0].toLowerCase().includes(suffix);
3304
- };
3305
- }
3306
- const isHls = isType(".m3u8");
3307
- const isMp4 = isType(".mp4");
3308
- const isFlv = isType(".flv");
3309
- const isRtm = isType(".sdp");
3310
- const isDash = isType(".mpd");
3311
- function getStreamType(url) {
3312
- if (isHls(url)) {
3313
- return "hls";
3314
- }
3315
- if (isFlv(url)) {
3316
- return "flv";
3317
- }
3318
- if (isRtm(url)) {
3319
- return "rtm";
3320
- }
3321
- if (isMp4(url)) {
3322
- return "mp4";
3323
- }
3324
- if (isDash(url)) {
3325
- return "dash";
3326
- }
3327
- return "unknown";
3328
- }
3329
- const DynamicModule$1 = window["VePlayer"].DynamicModule;
3330
- const load$1 = window["VePlayer"].load;
3331
- const getAbrStrategy = async (options) => {
3332
- var _a, _b;
3333
- const streamType = options.url && getStreamType(options.url);
3334
- if (streamType === "rtm") {
3335
- return {};
3336
- }
3337
- const abrOptions = streamType === "flv" ? (_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.abr : (_b = options == null ? void 0 : options.hls) == null ? void 0 : _b.abr;
3338
- if (!abrOptions) {
3339
- return {};
3340
- }
3341
- const abrPlugin = await load$1(DynamicModule$1.PluginAbr).catch(() => void 0);
3342
- return {
3343
- options: {
3344
- [streamType === "flv" ? "abr" : "hlsabr"]: {
3345
- ...abrOptions,
3346
- open: abrOptions.enable ?? true
3347
- }
3348
- },
3349
- plugins: [
3350
- streamType === "flv" ? abrPlugin == null ? void 0 : abrPlugin.AbrPlugin : abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin
3351
- ]
3352
- };
3353
- };
3354
3366
  const DEFAULT_PLUGINS = window["VePlayer"].DEFAULT_PLUGINS;
3355
3367
  const VePlayerBase = window["VePlayer"].VePlayerBase;
3356
3368
  const VeI18n = window["VePlayer"].VeI18n;