@volcengine/veplayer 2.2.1-rc.0 → 2.3.0-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.
Files changed (43) hide show
  1. package/LICENSE +20 -0
  2. package/esm/index.d.ts +84 -88
  3. package/esm/veplayer.biz.live.development.js +104 -27
  4. package/esm/veplayer.biz.live.production.js +1 -1
  5. package/esm/veplayer.d.ts +327 -178
  6. package/esm/veplayer.development.css +1 -1
  7. package/esm/veplayer.development.js +457 -142
  8. package/esm/veplayer.live.d.ts +327 -178
  9. package/esm/veplayer.live.development.css +1 -1
  10. package/esm/veplayer.live.development.js +457 -142
  11. package/esm/veplayer.live.production.css +1 -1
  12. package/esm/veplayer.live.production.js +3 -3
  13. package/esm/veplayer.production.css +1 -1
  14. package/esm/veplayer.production.js +3 -3
  15. package/esm/veplayer.vod.d.ts +84 -88
  16. package/esm/veplayer.vod.development.css +1 -1
  17. package/esm/veplayer.vod.development.js +366 -125
  18. package/esm/veplayer.vod.production.css +1 -1
  19. package/esm/veplayer.vod.production.js +2 -2
  20. package/package.json +1 -1
  21. package/umd/index.d.ts +84 -88
  22. package/umd/veplayer.biz.live.development.js +107 -30
  23. package/umd/veplayer.biz.live.production.js +1 -1
  24. package/umd/veplayer.biz.vod.development.js +3 -2
  25. package/umd/veplayer.biz.vod.production.js +1 -1
  26. package/umd/veplayer.d.ts +327 -178
  27. package/umd/veplayer.development.css +1 -1
  28. package/umd/veplayer.development.js +456 -141
  29. package/umd/veplayer.live.d.ts +327 -178
  30. package/umd/veplayer.live.development.css +1 -1
  31. package/umd/veplayer.live.development.js +459 -144
  32. package/umd/veplayer.live.production.css +1 -1
  33. package/umd/veplayer.live.production.js +1 -1
  34. package/umd/veplayer.production.css +1 -1
  35. package/umd/veplayer.production.js +1 -1
  36. package/umd/veplayer.vod.d.ts +84 -88
  37. package/umd/veplayer.vod.development.css +1 -1
  38. package/umd/veplayer.vod.development.js +371 -130
  39. package/umd/veplayer.vod.production.css +1 -1
  40. package/umd/veplayer.vod.production.js +1 -1
  41. package/veplayer.d.ts +327 -178
  42. package/veplayer.live.d.ts +327 -178
  43. package/veplayer.vod.d.ts +84 -88
@@ -32,30 +32,30 @@ var __publicField = (obj, key, value) => {
32
32
  function create(errorCode, i18n) {
33
33
  return new VeError(ERRORS[errorCode], i18n);
34
34
  }
35
- const DynamicModule$2 = window["VePlayer"].DynamicModule;
36
- const load$2 = window["VePlayer"].load;
35
+ const DynamicModule$3 = window["VePlayer"].DynamicModule;
36
+ const load$3 = window["VePlayer"].load;
37
37
  async function isRTMSupported() {
38
- const { RtmPlugin } = await load$2(DynamicModule$2.PluginRtm);
38
+ const { RtmPlugin } = await load$3(DynamicModule$3.PluginRtm);
39
39
  return RtmPlugin.isSupported();
40
40
  }
41
41
  async function isRTMSupportCodec(codec = RTMCodec.H264) {
42
- const { RtmPlugin } = await load$2(DynamicModule$2.PluginRtm);
42
+ const { RtmPlugin } = await load$3(DynamicModule$3.PluginRtm);
43
43
  if (codec === RTMCodec.H264)
44
44
  return RtmPlugin.isSupportedH264();
45
45
  return false;
46
46
  }
47
47
  const strategy$1 = window["VePlayer"].strategy;
48
48
  const util$4 = window["VePlayer"].util;
49
- const DynamicModule$1 = window["VePlayer"].DynamicModule;
50
- const load$1 = window["VePlayer"].load;
49
+ const DynamicModule$2 = window["VePlayer"].DynamicModule;
50
+ const load$2 = window["VePlayer"].load;
51
51
  const Codec$1 = window["VePlayer"].Codec;
52
- const Sniffer$2 = window["VePlayer"].Sniffer;
52
+ const Sniffer$3 = window["VePlayer"].Sniffer;
53
53
  const rtmStrategy = {
54
54
  options: {},
55
- module: DynamicModule$1.PluginRtm
55
+ module: DynamicModule$2.PluginRtm
56
56
  };
57
57
  const generateFallbackUrl = (url) => {
58
- if (Sniffer$2.device === "pc") {
58
+ if (Sniffer$3.device === "pc") {
59
59
  return url.replace(".sdp", ".flv");
60
60
  } else {
61
61
  return url.replace(".sdp", ".m3u8");
@@ -75,17 +75,17 @@ var __publicField = (obj, key, value) => {
75
75
  const backupType = actualFallbackUrl && util$4.getStreamType(actualFallbackUrl);
76
76
  if (backupType === "flv" && util$4.isMseSupported(Codec$1.H264)) {
77
77
  backupStrategy = strategy$1.createFlvMseStrategy(options);
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)) {
78
+ } 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
79
  backupStrategy = strategy$1.createHlsMseStrategy(options);
80
80
  }
81
81
  const [rtmCdn, backupCdn] = await Promise.all([
82
- load$1(rtmStrategy.module).then((module2) => {
82
+ load$2(rtmStrategy.module).then((module2) => {
83
83
  return module2.RtmPlugin;
84
84
  }).catch(() => void 0),
85
- backupStrategy && load$1(backupStrategy.module).then((module2) => {
86
- if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$1.PluginFlv) {
85
+ backupStrategy && load$2(backupStrategy.module).then((module2) => {
86
+ if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.PluginFlv) {
87
87
  return module2.FlvPlugin;
88
- } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$1.PluginHls) {
88
+ } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.PluginHls) {
89
89
  return module2.HlsPlugin;
90
90
  }
91
91
  }).catch(() => void 0)
@@ -133,6 +133,30 @@ var __publicField = (obj, key, value) => {
133
133
  plugins: rtmCdn ? [rtmCdn] : []
134
134
  };
135
135
  };
136
+ const Sniffer$2 = window["VePlayer"].Sniffer;
137
+ var DrmType = /* @__PURE__ */ ((DrmType2) => {
138
+ DrmType2["Fairplay"] = "fairplay";
139
+ return DrmType2;
140
+ })(DrmType || {});
141
+ function getDrmType(drm) {
142
+ if ((drm == null ? void 0 : drm.fairplay) && (Sniffer$2.browser === "safari" || Sniffer$2.os.isIos)) {
143
+ return "fairplay";
144
+ }
145
+ return;
146
+ }
147
+ function isMseSupportedWithDrm({
148
+ drm,
149
+ streamType
150
+ }) {
151
+ const drmType = getDrmType(drm);
152
+ if (!drmType) {
153
+ return true;
154
+ }
155
+ if (drmType === "fairplay" && streamType === "hls") {
156
+ return false;
157
+ }
158
+ return true;
159
+ }
136
160
  const util$3 = window["VePlayer"].util;
137
161
  const strategy = window["VePlayer"].strategy;
138
162
  const getTypeStrategy = async (options, player) => {
@@ -147,6 +171,9 @@ var __publicField = (obj, key, value) => {
147
171
  return await strategy.getFlvStrategy(options);
148
172
  }
149
173
  if (type === "hls") {
174
+ if (!isMseSupportedWithDrm({ drm: options.drm, streamType: type })) {
175
+ return { options: {}, plugins: [] };
176
+ }
150
177
  return await strategy.getHlsStrategy(options);
151
178
  }
152
179
  return { options: {}, plugins: [] };
@@ -286,9 +313,9 @@ var __publicField = (obj, key, value) => {
286
313
  const Events = {
287
314
  ...event.Events,
288
315
  // 直播的Events
289
- TIME_SHIFT_CHANGE: "time_shift_change",
316
+ TIME_SHIFT_CHANGE: "timeShiftChange",
290
317
  // 切换时移状态
291
- REFRESH_CLICK: "refresh_click"
318
+ REFRESH_CLICK: "refreshClick"
292
319
  // 触发刷新
293
320
  };
294
321
  function RefreshIcon() {
@@ -2833,9 +2860,6 @@ var __publicField = (obj, key, value) => {
2833
2860
  return v4().replace(/-/g, "") + "." + Date.now() + "." + hashCode(v4().replace(/-/g, ""));
2834
2861
  };
2835
2862
  const Plugin$2 = window["VePlayer"].Plugin;
2836
- const CN_APPID = 468759;
2837
- const CHANNEL = "cn";
2838
- const CHANNEL_DOMAIN = "//mcs.volceapplog.com";
2839
2863
  class Logger extends Plugin$2 {
2840
2864
  constructor() {
2841
2865
  super(...arguments);
@@ -2890,9 +2914,8 @@ var __publicField = (obj, key, value) => {
2890
2914
  }
2891
2915
  _createTea() {
2892
2916
  q.init({
2893
- app_id: CN_APPID,
2894
- channel: CHANNEL,
2895
- channel_domain: CHANNEL_DOMAIN
2917
+ app_id: 468759,
2918
+ channel: "cn"
2896
2919
  });
2897
2920
  q.start();
2898
2921
  q.config({
@@ -2911,9 +2934,9 @@ var __publicField = (obj, key, value) => {
2911
2934
  user_id: this._userId,
2912
2935
  device_id: this._deviceId,
2913
2936
  ext: {
2914
- veplayer_version: "2.2.1-rc.0",
2915
- flv_version: "3.0.11-alpha.2",
2916
- hls_version: "3.0.11-alpha.2",
2937
+ veplayer_version: "2.3.0-rc.0",
2938
+ flv_version: "3.0.12",
2939
+ hls_version: "3.0.12",
2917
2940
  rts_version: "0.2.0-alpha.5"
2918
2941
  }
2919
2942
  });
@@ -3064,7 +3087,7 @@ var __publicField = (obj, key, value) => {
3064
3087
  _tick() {
3065
3088
  clearTimeout(this._pollTimer);
3066
3089
  this._renderPanel();
3067
- this._pollTimer = setTimeout(() => {
3090
+ this._pollTimer = window.setTimeout(() => {
3068
3091
  this._tick();
3069
3092
  }, this.config.interval);
3070
3093
  }
@@ -3182,6 +3205,39 @@ var __publicField = (obj, key, value) => {
3182
3205
  DECODE_INFO: "软解信息",
3183
3206
  REFRESH: "刷新"
3184
3207
  };
3208
+ const DynamicModule$1 = window["VePlayer"].DynamicModule;
3209
+ const load$1 = window["VePlayer"].load;
3210
+ const getDrmStrategy = async (options, player) => {
3211
+ var _a;
3212
+ const drmType = getDrmType(options.drm);
3213
+ if (options.url && drmType === DrmType.Fairplay) {
3214
+ try {
3215
+ const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
3216
+ const [drmPlugin, drmConfig] = await Promise.all([
3217
+ load$1(DynamicModule$1.PluginDrm).then((module2) => module2.DrmPlugin).catch(() => void 0),
3218
+ getDrmConfig == null ? void 0 : getDrmConfig({
3219
+ url: options.url
3220
+ })
3221
+ ]);
3222
+ const fairplayDrmConfig = Object.assign(
3223
+ {},
3224
+ originFairplayConfig,
3225
+ options == null ? void 0 : options.drm,
3226
+ drmConfig
3227
+ );
3228
+ drmConfig && (player == null ? void 0 : player.updateDrmConfig(drmConfig));
3229
+ return {
3230
+ options: {
3231
+ drm: fairplayDrmConfig
3232
+ },
3233
+ plugins: drmPlugin ? [drmPlugin] : []
3234
+ };
3235
+ } catch (error2) {
3236
+ console.log(error2);
3237
+ }
3238
+ }
3239
+ return {};
3240
+ };
3185
3241
  const DEFAULT_PLUGINS = window["VePlayer"].DEFAULT_PLUGINS;
3186
3242
  const VePlayerBase = window["VePlayer"].VePlayerBase;
3187
3243
  const VeI18n = window["VePlayer"].VeI18n;
@@ -3240,6 +3296,14 @@ var __publicField = (obj, key, value) => {
3240
3296
  var _a;
3241
3297
  (_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
3242
3298
  }
3299
+ /** {zh}
3300
+ * @brief 调用此方法更新 DRM 鉴权配置。
3301
+ * @hidden
3302
+ */
3303
+ updateDrmConfig(config) {
3304
+ var _a, _b, _c;
3305
+ (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
3306
+ }
3243
3307
  }
3244
3308
  async function createLivePlayer(options) {
3245
3309
  var _a, _b;
@@ -3264,7 +3328,16 @@ var __publicField = (obj, key, value) => {
3264
3328
  };
3265
3329
  },
3266
3330
  async preparePlugins(url) {
3267
- return getTypeStrategy({ ...finalOptions, url }, player);
3331
+ const [typeStrategy, drmStrategy] = await Promise.all([
3332
+ getTypeStrategy({ ...finalOptions, url }, player),
3333
+ getDrmStrategy({ ...finalOptions, url }, player)
3334
+ ]);
3335
+ const { options: options2, plugins } = typeStrategy ?? {};
3336
+ const { options: drmOptions, plugins: drmPlugins } = drmStrategy ?? {};
3337
+ return {
3338
+ options: Object.assign({}, options2, drmOptions),
3339
+ plugins: [...plugins ?? [], ...drmPlugins ?? []]
3340
+ };
3268
3341
  }
3269
3342
  },
3270
3343
  VePlayerLive
@@ -3294,6 +3367,7 @@ var __publicField = (obj, key, value) => {
3294
3367
  const Degradation = window["VePlayer"].Degradation;
3295
3368
  const POSITIONS = window["VePlayer"].POSITIONS;
3296
3369
  const register = window["VePlayer"].register;
3370
+ const registerPlugin = window["VePlayer"].registerPlugin;
3297
3371
  const EN = window["VePlayer"].EN;
3298
3372
  const ZH_CN = window["VePlayer"].ZH_CN;
3299
3373
  const Plugin = window["VePlayer"].Plugin;
@@ -3301,15 +3375,16 @@ var __publicField = (obj, key, value) => {
3301
3375
  const DynamicModule = window["VePlayer"].DynamicModule;
3302
3376
  const util = window["VePlayer"].util;
3303
3377
  const load = window["VePlayer"].load;
3378
+ const ListType = window["VePlayer"].ListType;
3304
3379
  setModuleSystem("umd");
3305
3380
  const isMseSupported = util.isMseSupported;
3306
3381
  const isSoftDecodeSupported = util.isSoftDecodeSupported;
3307
- if (typeof VePlayer.register !== "undefined") {
3308
- VePlayer.register(DynamicModule.BizLive, {
3382
+ if (typeof VePlayer.registerPlugin !== "undefined") {
3383
+ VePlayer.registerPlugin(DynamicModule.BizLive, {
3309
3384
  createLivePlayer
3310
3385
  });
3311
3386
  } else {
3312
- register(DynamicModule.BizLive, {
3387
+ registerPlugin(DynamicModule.BizLive, {
3313
3388
  createLivePlayer
3314
3389
  });
3315
3390
  }
@@ -3318,6 +3393,7 @@ var __publicField = (obj, key, value) => {
3318
3393
  exports2.Degradation = Degradation;
3319
3394
  exports2.DynamicModule = DynamicModule;
3320
3395
  exports2.EN = EN;
3396
+ exports2.ListType = ListType;
3321
3397
  exports2.POSITIONS = POSITIONS;
3322
3398
  exports2.Plugin = Plugin;
3323
3399
  exports2.RTMCodec = RTMCodec;
@@ -3331,5 +3407,6 @@ var __publicField = (obj, key, value) => {
3331
3407
  exports2.live = live;
3332
3408
  exports2.load = load;
3333
3409
  exports2.register = register;
3410
+ exports2.registerPlugin = registerPlugin;
3334
3411
  exports2.util = util;
3335
3412
  });