@volcengine/veplayer 2.8.0-rc.2 → 2.8.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.
@@ -199,7 +199,7 @@ var __publicField = (obj, key, value) => {
199
199
  }
200
200
  var refresh = "";
201
201
  const Plugin$3 = window["VePlayer"].Plugin;
202
- const Sniffer$5 = window["VePlayer"].Sniffer;
202
+ const Sniffer$4 = window["VePlayer"].Sniffer;
203
203
  const XGEvents = window["VePlayer"].XGEvents;
204
204
  const { POSITIONS: POSITIONS$1 } = Plugin$3;
205
205
  class Refresh extends Plugin$3 {
@@ -263,7 +263,7 @@ var __publicField = (obj, key, value) => {
263
263
  }
264
264
  _initEvents() {
265
265
  this._handleRefresh = debounce$1(this._handleRefresh.bind(this), 200);
266
- const event2 = Sniffer$5.device === "mobile" ? "touchend" : "click";
266
+ const event2 = Sniffer$4.device === "mobile" ? "touchend" : "click";
267
267
  this.bind(event2, this._handleRefresh);
268
268
  this.show();
269
269
  }
@@ -2219,10 +2219,10 @@ var __publicField = (obj, key, value) => {
2219
2219
  device_id: (_f = (_e2 = this.player.config) == null ? void 0 : _e2.teaTracker) == null ? void 0 : _f.deviceId,
2220
2220
  error_report_stop: true,
2221
2221
  ext: {
2222
- veplayer_version: "2.3.1-rc.1",
2222
+ veplayer_version: "2.3.0",
2223
2223
  flv_version: "3.0.21-rc.21",
2224
2224
  hls_version: "3.0.21-rc.21",
2225
- rts_version: "0.2.1-alpha.30"
2225
+ rts_version: "0.2.1-alpha.35"
2226
2226
  }
2227
2227
  });
2228
2228
  }
@@ -2604,6 +2604,7 @@ var __publicField = (obj, key, value) => {
2604
2604
  "plugin:mp4": "veplayer.plugin.mp4.[env].[ext]",
2605
2605
  "plugin:hls": "veplayer.plugin.hls.[env].[ext]",
2606
2606
  "plugin:hlsjs": "veplayer.plugin.hlsjs.[env].[ext]",
2607
+ "plugin:dashjs": "veplayer.plugin.dashjs.[env].[ext]",
2607
2608
  "plugin:shaka": "veplayer.plugin.shaka.[env].[ext]",
2608
2609
  "plugin:rtm": "veplayer.plugin.rtm.[env].[ext]",
2609
2610
  "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]",
@@ -2619,6 +2620,7 @@ var __publicField = (obj, key, value) => {
2619
2620
  DynamicModule2["PluginMp4"] = "plugin:mp4";
2620
2621
  DynamicModule2["PluginHls"] = "plugin:hls";
2621
2622
  DynamicModule2["PluginHlsJs"] = "plugin:hlsjs";
2623
+ DynamicModule2["PluginDashJs"] = "plugin:dashjs";
2622
2624
  DynamicModule2["PluginShaka"] = "plugin:shaka";
2623
2625
  DynamicModule2["PluginRtm"] = "plugin:rtm";
2624
2626
  DynamicModule2["PluginXgvideo"] = "plugin:xgvideo";
@@ -4691,11 +4693,20 @@ var __publicField = (obj, key, value) => {
4691
4693
  ErrorCode2[ErrorCode2["MEDIA_MSE_HIJACK"] = 5204] = "MEDIA_MSE_HIJACK";
4692
4694
  ErrorCode2[ErrorCode2["MEDIA_EME_HIJACK"] = 5301] = "MEDIA_EME_HIJACK";
4693
4695
  ErrorCode2[ErrorCode2["DRM_LICENSE"] = 7100] = "DRM_LICENSE";
4696
+ ErrorCode2[ErrorCode2["DRM_UNSUPPORTED"] = 7101] = "DRM_UNSUPPORTED";
4697
+ ErrorCode2[ErrorCode2["DRM_NO_MEDIA_KEY"] = 7103] = "DRM_NO_MEDIA_KEY";
4698
+ ErrorCode2[ErrorCode2["DRM_NO_KEY_SESSION"] = 7104] = "DRM_NO_KEY_SESSION";
4699
+ ErrorCode2[ErrorCode2["DRM_GENERATE_QUEST_FAIL"] = 7105] = "DRM_GENERATE_QUEST_FAIL";
4700
+ ErrorCode2[ErrorCode2["DRM_LACK_SERVER_CERTIFICATE_PATH"] = 7106] = "DRM_LACK_SERVER_CERTIFICATE_PATH";
4701
+ ErrorCode2[ErrorCode2["DRM_LACK_SERVER_PROCESS_SPC_PATH"] = 7107] = "DRM_LACK_SERVER_PROCESS_SPC_PATH";
4702
+ ErrorCode2[ErrorCode2["DRM_LICENSE_FAIL"] = 7108] = "DRM_LICENSE_FAIL";
4703
+ ErrorCode2[ErrorCode2["DRM_KEY_ERROR"] = 7109] = "DRM_KEY_ERROR";
4704
+ ErrorCode2[ErrorCode2["DRM_CERT_FAIL"] = 7110] = "DRM_CERT_FAIL";
4694
4705
  ErrorCode2[ErrorCode2["DRM_CUSTOM_LICENSE"] = 7200] = "DRM_CUSTOM_LICENSE";
4695
4706
  ErrorCode2[ErrorCode2["OTHER"] = 8e3] = "OTHER";
4696
4707
  ErrorCode2[ErrorCode2["RUNTIME_NO_CANPLAY_ERROR"] = 9001] = "RUNTIME_NO_CANPLAY_ERROR";
4697
4708
  ErrorCode2[ErrorCode2["RUNTIME_BUFFERBREAK_ERROR"] = 9002] = "RUNTIME_BUFFERBREAK_ERROR";
4698
- ErrorCode2[ErrorCode2["RUNTIME_BWAITING_TIMEOUT_ERROR"] = 9002] = "RUNTIME_BWAITING_TIMEOUT_ERROR";
4709
+ ErrorCode2[ErrorCode2["RUNTIME_WAITING_TIMEOUT_ERROR"] = 9003] = "RUNTIME_WAITING_TIMEOUT_ERROR";
4699
4710
  ErrorCode2[ErrorCode2["MODULE_LOAD_ERROR"] = 110] = "MODULE_LOAD_ERROR";
4700
4711
  ErrorCode2["UNKNOWN"] = "UNKNOWN";
4701
4712
  return ErrorCode2;
@@ -4796,6 +4807,78 @@ var __publicField = (obj, key, value) => {
4796
4807
  messageTextKey: "DRM_LICENSE",
4797
4808
  level: "Fatal"
4798
4809
  /* Fatal */
4810
+ },
4811
+ [
4812
+ 7101
4813
+ /* DRM_UNSUPPORTED */
4814
+ ]: {
4815
+ messageTextKey: "DRM_UNSUPPORTED",
4816
+ level: "Fatal"
4817
+ /* Fatal */
4818
+ },
4819
+ [
4820
+ 7103
4821
+ /* DRM_NO_MEDIA_KEY */
4822
+ ]: {
4823
+ messageTextKey: "DRM_NO_MEDIA_KEY",
4824
+ level: "Fatal"
4825
+ /* Fatal */
4826
+ },
4827
+ [
4828
+ 7104
4829
+ /* DRM_NO_KEY_SESSION */
4830
+ ]: {
4831
+ messageTextKey: "DRM_NO_KEY_SESSION",
4832
+ level: "Fatal"
4833
+ /* Fatal */
4834
+ },
4835
+ [
4836
+ 7105
4837
+ /* DRM_GENERATE_QUEST_FAIL */
4838
+ ]: {
4839
+ messageTextKey: "DRM_GENERATE_QUEST_FAIL",
4840
+ level: "Fatal"
4841
+ /* Fatal */
4842
+ },
4843
+ [
4844
+ 7106
4845
+ /* DRM_LACK_SERVER_CERTIFICATE_PATH */
4846
+ ]: {
4847
+ messageTextKey: "DRM_LACK_SERVER_CERTIFICATE_PATH",
4848
+ level: "Fatal"
4849
+ /* Fatal */
4850
+ },
4851
+ [
4852
+ 7107
4853
+ /* DRM_LACK_SERVER_PROCESS_SPC_PATH */
4854
+ ]: {
4855
+ messageTextKey: "DRM_LACK_SERVER_PROCESS_SPC_PATH",
4856
+ level: "Fatal"
4857
+ /* Fatal */
4858
+ },
4859
+ [
4860
+ 7108
4861
+ /* DRM_LICENSE_FAIL */
4862
+ ]: {
4863
+ messageTextKey: "DRM_LICENSE_FAIL",
4864
+ level: "Fatal"
4865
+ /* Fatal */
4866
+ },
4867
+ [
4868
+ 7109
4869
+ /* DRM_KEY_ERROR */
4870
+ ]: {
4871
+ messageTextKey: "DRM_KEY_ERROR",
4872
+ level: "Fatal"
4873
+ /* Fatal */
4874
+ },
4875
+ [
4876
+ 7110
4877
+ /* DRM_CERT_FAIL */
4878
+ ]: {
4879
+ messageTextKey: "DRM_CERT_FAIL",
4880
+ level: "Fatal"
4881
+ /* Fatal */
4799
4882
  }
4800
4883
  };
4801
4884
  class VeError extends Error {
@@ -4873,11 +4956,11 @@ var __publicField = (obj, key, value) => {
4873
4956
  });
4874
4957
  }
4875
4958
  }
4876
- var Codec$6 = /* @__PURE__ */ ((Codec2) => {
4959
+ var Codec$7 = /* @__PURE__ */ ((Codec2) => {
4877
4960
  Codec2["H265"] = "h265";
4878
4961
  Codec2["H264"] = "h264";
4879
4962
  return Codec2;
4880
- })(Codec$6 || {});
4963
+ })(Codec$7 || {});
4881
4964
  const appendSearchParams$1 = (url2, searchParams) => {
4882
4965
  var _a, _b;
4883
4966
  const urlObject = getUrlObject(url2);
@@ -4980,11 +5063,11 @@ var __publicField = (obj, key, value) => {
4980
5063
  }
4981
5064
  return "unknown";
4982
5065
  }
4983
- function isMseSupported$3(codec = Codec$6.H264) {
4984
- if (codec === Codec$6.H265) {
5066
+ function isMseSupported$3(codec = Codec$7.H264) {
5067
+ if (codec === Codec$7.H265) {
4985
5068
  return sniffer.isHevcSupported();
4986
5069
  }
4987
- if (codec === Codec$6.H264) {
5070
+ if (codec === Codec$7.H264) {
4988
5071
  return sniffer.isMSESupport();
4989
5072
  }
4990
5073
  return sniffer.isMSESupport(codec);
@@ -4993,14 +5076,14 @@ var __publicField = (obj, key, value) => {
4993
5076
  const { XGVideoPlugin } = await load$9(DynamicModule$7.PluginXgvideo);
4994
5077
  return XGVideoPlugin == null ? void 0 : XGVideoPlugin.isSupported();
4995
5078
  }
4996
- function isMMSSupported$2(codec = Codec$6.H264) {
5079
+ function isMMSSupported$2(codec = Codec$7.H264) {
4997
5080
  if (typeof window.ManagedMediaSource === "undefined") {
4998
5081
  return false;
4999
5082
  }
5000
- if (codec === Codec$6.H264) {
5083
+ if (codec === Codec$7.H264) {
5001
5084
  return window.ManagedMediaSource.isTypeSupported(H264_MIME);
5002
5085
  }
5003
- if (codec === Codec$6.H265) {
5086
+ if (codec === Codec$7.H265) {
5004
5087
  return H265_MIME.some((mine) => {
5005
5088
  return window.ManagedMediaSource.isTypeSupported(mine);
5006
5089
  });
@@ -5022,16 +5105,31 @@ var __publicField = (obj, key, value) => {
5022
5105
  LLHls: "ll-hls",
5023
5106
  Flv: "flv",
5024
5107
  Rtm: "rtm",
5025
- LLFlv: "ll-flv"
5108
+ LLFlv: "ll-flv",
5109
+ Dash: "dash"
5026
5110
  };
5027
- const Sniffer$4 = window["VePlayer"].Sniffer;
5028
- const Codec$5 = window["VePlayer"].Codec;
5111
+ const KeyNameMap = {
5112
+ [
5113
+ "widevine"
5114
+ /* Widevine */
5115
+ ]: "com.widevine.alpha",
5116
+ [
5117
+ "playready"
5118
+ /* Playready */
5119
+ ]: "com.microsoft.playready",
5120
+ [
5121
+ "fairplay"
5122
+ /* Fairplay */
5123
+ ]: "com.apple.fps"
5124
+ };
5125
+ const Sniffer$3 = window["VePlayer"].Sniffer;
5126
+ const Codec$6 = window["VePlayer"].Codec;
5029
5127
  const util$5 = window["VePlayer"].util;
5030
5128
  const { isMMSSupported: isMMSSupported$1, isMseSupported: isMseSupported$2 } = util$5;
5031
5129
  function enableMMS() {
5032
- return Sniffer$4.os.isIos;
5130
+ return Sniffer$3.os.isIos;
5033
5131
  }
5034
- function isFLVSupported(codec = Codec$5.H264) {
5132
+ function isFLVSupported(codec = Codec$6.H264) {
5035
5133
  const isMediaSourceSupported = enableMMS() ? isMMSSupported$1 : isMseSupported$2;
5036
5134
  return isMediaSourceSupported(codec);
5037
5135
  }
@@ -5086,7 +5184,7 @@ var __publicField = (obj, key, value) => {
5086
5184
  }
5087
5185
  const strategy$2 = window["VePlayer"].strategy;
5088
5186
  const load$8 = window["VePlayer"].load;
5089
- const Codec$4 = window["VePlayer"].Codec;
5187
+ const Codec$5 = window["VePlayer"].Codec;
5090
5188
  const util$4 = window["VePlayer"].util;
5091
5189
  const { appendSearchParams } = util$4;
5092
5190
  const getFlvStrategy = async (options) => {
@@ -5099,10 +5197,10 @@ var __publicField = (obj, key, value) => {
5099
5197
  const codec = await strategy$2.getCodec(options);
5100
5198
  const isSoftDecode = await strategy$2.isSoftDecode(options, codec);
5101
5199
  if (isSoftDecode) {
5102
- softStrategy = codec === Codec$4.H265 ? strategy$2.createSoftDecodeH265Strategy() : strategy$2.createSoftDecodeH264Strategy();
5200
+ softStrategy = codec === Codec$5.H265 ? strategy$2.createSoftDecodeH265Strategy() : strategy$2.createSoftDecodeH264Strategy();
5103
5201
  mseStrategy = strategy$2.createFlvMseStrategy(options);
5104
5202
  }
5105
- if (codec === "unknown" ? isFLVSupported(Codec$4.H264) : isFLVSupported(codec)) {
5203
+ if (codec === "unknown" ? isFLVSupported(Codec$5.H264) : isFLVSupported(codec)) {
5106
5204
  mseStrategy = enableMMS() ? strategy$2.createFlvMssStrategy(options) : strategy$2.createFlvMseStrategy(options);
5107
5205
  }
5108
5206
  if (!mseStrategy && !softStrategy) {
@@ -5195,6 +5293,9 @@ var __publicField = (obj, key, value) => {
5195
5293
  getVeStrategy() {
5196
5294
  return void 0;
5197
5295
  }
5296
+ updateDrmConfig() {
5297
+ return void 0;
5298
+ }
5198
5299
  }
5199
5300
  class FlvLowLatencyProtocol extends FlvProtocol {
5200
5301
  get protocolType() {
@@ -5210,61 +5311,67 @@ var __publicField = (obj, key, value) => {
5210
5311
  });
5211
5312
  }
5212
5313
  }
5213
- const Sniffer$3 = window["VePlayer"].Sniffer;
5214
- var DrmType = /* @__PURE__ */ ((DrmType2) => {
5215
- DrmType2["Fairplay"] = "fairplay";
5216
- return DrmType2;
5217
- })(DrmType || {});
5218
- function getDrmType(drm) {
5219
- if ((drm == null ? void 0 : drm.fairplay) && (Sniffer$3.browser === "safari" || Sniffer$3.os.isIos)) {
5220
- return "fairplay";
5221
- }
5222
- return;
5314
+ const Sniffer$2 = window["VePlayer"].Sniffer;
5315
+ function preferNativeForFairplay(options) {
5316
+ var _a;
5317
+ return ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) && (Sniffer$2.browser === "safari" || Sniffer$2.os.isIos);
5223
5318
  }
5224
- function isMseSupportedWithDrm({
5225
- drm,
5226
- streamType
5227
- }) {
5228
- const drmType = getDrmType(drm);
5229
- if (!drmType) {
5230
- return true;
5231
- }
5232
- if (drmType === "fairplay" && streamType === "hls") {
5319
+ function enableMse(options) {
5320
+ var _a;
5321
+ if (preferNativeForFairplay(options)) {
5233
5322
  return false;
5234
5323
  }
5235
- return true;
5324
+ return Sniffer$2.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE);
5236
5325
  }
5237
- const Codec$3 = window["VePlayer"].Codec;
5238
- const strategy$1 = window["VePlayer"].strategy;
5239
- const load$6 = window["VePlayer"].load;
5240
- const Sniffer$2 = window["VePlayer"].Sniffer;
5241
- const util$3 = window["VePlayer"].util;
5242
- const { isMseSupported: isMseSupported$1 } = util$3;
5243
5326
  function enableHlsJs(options) {
5244
- var _a, _b;
5245
- if ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableHlsJs) {
5327
+ var _a, _b, _c;
5328
+ if (typeof ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableHlsJs) !== "undefined") {
5329
+ return (_b = options.hls) == null ? void 0 : _b.enableHlsJs;
5330
+ }
5331
+ if (((_c = options == null ? void 0 : options.ad) == null ? void 0 : _c.adType) === "ssai") {
5246
5332
  return true;
5247
5333
  }
5248
- if (((_b = options == null ? void 0 : options.ad) == null ? void 0 : _b.adType) === "ssai") {
5334
+ if (options.drm) {
5249
5335
  return true;
5250
5336
  }
5251
5337
  return false;
5252
5338
  }
5339
+ function transformHlsDrmConfig(drmConfig) {
5340
+ const drmSystems = {};
5341
+ for (const key in drmConfig) {
5342
+ if (drmConfig.hasOwnProperty(key)) {
5343
+ const drmSystemKey = KeyNameMap[key];
5344
+ const drmSystemUrls = drmConfig[key];
5345
+ if (drmSystemKey && drmSystemUrls) {
5346
+ drmSystems[drmSystemKey] = {
5347
+ licenseUrl: drmSystemUrls == null ? void 0 : drmSystemUrls.serverProcessSPCPath,
5348
+ serverCertificateUrl: drmSystemUrls == null ? void 0 : drmSystemUrls.serverCertificatePath
5349
+ };
5350
+ }
5351
+ }
5352
+ }
5353
+ return {
5354
+ emeEnabled: true,
5355
+ drmSystems
5356
+ };
5357
+ }
5358
+ const Codec$4 = window["VePlayer"].Codec;
5359
+ const strategy$1 = window["VePlayer"].strategy;
5360
+ const load$6 = window["VePlayer"].load;
5361
+ const util$3 = window["VePlayer"].util;
5362
+ const { isMseSupported: isMseSupported$1 } = util$3;
5253
5363
  const getHlsStrategy = async (options) => {
5254
- var _a, _b;
5364
+ var _a;
5255
5365
  let mseStrategy;
5256
5366
  let softStrategy;
5257
- if (!isMseSupportedWithDrm({ drm: options.drm, streamType: "hls" })) {
5258
- return { options: {}, plugins: [] };
5259
- }
5260
5367
  const codec = await strategy$1.getCodec(options);
5261
5368
  const isSoftDecode = await strategy$1.isSoftDecode(options, codec);
5262
5369
  const useHlsJs = enableHlsJs(options);
5263
5370
  if (isSoftDecode) {
5264
- softStrategy = codec === Codec$3.H265 ? strategy$1.createSoftDecodeH265Strategy() : strategy$1.createSoftDecodeH264Strategy();
5371
+ softStrategy = codec === Codec$4.H265 ? strategy$1.createSoftDecodeH265Strategy() : strategy$1.createSoftDecodeH264Strategy();
5265
5372
  mseStrategy = strategy$1.createHlsMseStrategy(options, useHlsJs);
5266
5373
  }
5267
- if ((Sniffer$2.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && (codec === "unknown" ? isMseSupported$1(Codec$3.H264) : isMseSupported$1(codec))) {
5374
+ if (enableMse(options) && (codec === "unknown" ? isMseSupported$1(Codec$4.H264) : isMseSupported$1(codec))) {
5268
5375
  mseStrategy = strategy$1.createHlsMseStrategy(options, useHlsJs);
5269
5376
  }
5270
5377
  if (!mseStrategy && !softStrategy) {
@@ -5274,7 +5381,7 @@ var __publicField = (obj, key, value) => {
5274
5381
  (mseStrategy == null ? void 0 : mseStrategy.module) && load$6(mseStrategy.module).catch(() => void 0),
5275
5382
  (softStrategy == null ? void 0 : softStrategy.module) && load$6(softStrategy.module).catch(() => void 0)
5276
5383
  ]);
5277
- (softModule == null ? void 0 : softModule.XGVideoPlugin) && ((_b = softStrategy == null ? void 0 : softStrategy.afterLoad) == null ? void 0 : _b.call(softStrategy, softModule == null ? void 0 : softModule.XGVideoPlugin));
5384
+ (softModule == null ? void 0 : softModule.XGVideoPlugin) && ((_a = softStrategy == null ? void 0 : softStrategy.afterLoad) == null ? void 0 : _a.call(softStrategy, softModule == null ? void 0 : softModule.XGVideoPlugin));
5278
5385
  const combineOptions = strategy$1.combineOptions([mseStrategy, softStrategy]);
5279
5386
  return {
5280
5387
  options: combineOptions,
@@ -5347,39 +5454,6 @@ var __publicField = (obj, key, value) => {
5347
5454
  }
5348
5455
  const DynamicModule$5 = window["VePlayer"].DynamicModule;
5349
5456
  const load$5 = window["VePlayer"].load;
5350
- const getDrmStrategy = async (options, player) => {
5351
- var _a;
5352
- const drmType = getDrmType(options.drm);
5353
- if (options.url && drmType === DrmType.Fairplay) {
5354
- try {
5355
- const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
5356
- const [drmPlugin, drmConfig] = await Promise.all([
5357
- load$5(DynamicModule$5.PluginDrm).then((module2) => module2.DrmPlugin).catch(() => void 0),
5358
- getDrmConfig == null ? void 0 : getDrmConfig({
5359
- url: options.url
5360
- })
5361
- ]);
5362
- const fairplayDrmConfig = Object.assign(
5363
- {},
5364
- originFairplayConfig,
5365
- options == null ? void 0 : options.drm,
5366
- drmConfig
5367
- );
5368
- drmConfig && (player == null ? void 0 : player.updateDrmConfig(drmConfig));
5369
- return {
5370
- options: {
5371
- drm: fairplayDrmConfig
5372
- },
5373
- plugins: drmPlugin ? [drmPlugin] : []
5374
- };
5375
- } catch (error2) {
5376
- console.log(error2);
5377
- }
5378
- }
5379
- return {};
5380
- };
5381
- const DynamicModule$4 = window["VePlayer"].DynamicModule;
5382
- const load$4 = window["VePlayer"].load;
5383
5457
  const util$2 = window["VePlayer"].util;
5384
5458
  class HlsProtocol extends BaseProtocol {
5385
5459
  static get suffix() {
@@ -5424,7 +5498,7 @@ var __publicField = (obj, key, value) => {
5424
5498
  if (!abrOptions) {
5425
5499
  return {};
5426
5500
  }
5427
- const abrPlugin = await load$4(DynamicModule$4.PluginAbr).catch(
5501
+ const abrPlugin = await load$5(DynamicModule$5.PluginAbr).catch(
5428
5502
  () => void 0
5429
5503
  );
5430
5504
  return {
@@ -5437,14 +5511,58 @@ var __publicField = (obj, key, value) => {
5437
5511
  plugins: [abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin]
5438
5512
  };
5439
5513
  }
5440
- getDrmStrategy(options, { player }) {
5441
- return getDrmStrategy(options, player);
5514
+ async updateDrmConfig(drmConfig, player) {
5515
+ var _a, _b, _c, _d;
5516
+ if (!drmConfig) {
5517
+ return;
5518
+ }
5519
+ const drmPlugin = (_b = (_a = player == null ? void 0 : player._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm;
5520
+ const hlsPlugin = (_d = (_c = player == null ? void 0 : player._player) == null ? void 0 : _c.plugins) == null ? void 0 : _d.hls;
5521
+ if (drmPlugin) {
5522
+ drmPlugin.restart();
5523
+ return drmPlugin.updateConfig(drmConfig);
5524
+ } else if (hlsPlugin) {
5525
+ hlsPlugin.config = {
5526
+ ...hlsPlugin.config,
5527
+ ...transformHlsDrmConfig(drmConfig)
5528
+ };
5529
+ }
5530
+ }
5531
+ async getDrmStrategy(options, { player }) {
5532
+ try {
5533
+ if (!(options == null ? void 0 : options.drm)) {
5534
+ return { options: {}, plugins: [] };
5535
+ }
5536
+ const drmConfig = (options == null ? void 0 : options.drm) ?? {};
5537
+ if (!preferNativeForFairplay(options) && enableHlsJs(options)) {
5538
+ return {
5539
+ options: {
5540
+ hls: {
5541
+ ...options.hls,
5542
+ ...transformHlsDrmConfig(drmConfig)
5543
+ }
5544
+ },
5545
+ plugins: []
5546
+ };
5547
+ }
5548
+ const drmPlugin = await load$5(DynamicModule$5.PluginDrm).then((module2) => module2.DrmPlugin).catch(() => void 0);
5549
+ drmConfig && await (player == null ? void 0 : player.updateDrmConfig(drmConfig));
5550
+ return {
5551
+ options: {
5552
+ drm: drmConfig
5553
+ },
5554
+ plugins: drmPlugin ? [drmPlugin] : []
5555
+ };
5556
+ } catch (error2) {
5557
+ console.log(error2);
5558
+ }
5559
+ return {};
5442
5560
  }
5443
5561
  getVeStrategy() {
5444
5562
  return void 0;
5445
5563
  }
5446
5564
  }
5447
- class HlsLowLatencyProtocol extends BaseProtocol {
5565
+ class HlsLowLatencyProtocol extends HlsProtocol {
5448
5566
  static get suffix() {
5449
5567
  return ".m3u8";
5450
5568
  }
@@ -5469,37 +5587,31 @@ var __publicField = (obj, key, value) => {
5469
5587
  async getProtocolStrategy(options) {
5470
5588
  return getHlsStrategy(options);
5471
5589
  }
5472
- getAbrStrategy() {
5473
- return void 0;
5474
- }
5475
- getDrmStrategy() {
5476
- return void 0;
5477
- }
5478
5590
  getVeStrategy() {
5479
5591
  return void 0;
5480
5592
  }
5481
5593
  }
5482
- const DynamicModule$3 = window["VePlayer"].DynamicModule;
5483
- const load$3 = window["VePlayer"].load;
5594
+ const DynamicModule$4 = window["VePlayer"].DynamicModule;
5595
+ const load$4 = window["VePlayer"].load;
5484
5596
  async function isRTMSupported() {
5485
- const { RtmPlugin } = await load$3(DynamicModule$3.PluginRtm);
5597
+ const { RtmPlugin } = await load$4(DynamicModule$4.PluginRtm);
5486
5598
  return RtmPlugin.isSupported();
5487
5599
  }
5488
5600
  async function isRTMSupportCodec(codec = RTMCodec.H264) {
5489
- const { RtmPlugin } = await load$3(DynamicModule$3.PluginRtm);
5601
+ const { RtmPlugin } = await load$4(DynamicModule$4.PluginRtm);
5490
5602
  if (codec === RTMCodec.H264)
5491
5603
  return RtmPlugin.isSupportedH264();
5492
5604
  return false;
5493
5605
  }
5494
5606
  const strategy = window["VePlayer"].strategy;
5495
5607
  const util$1 = window["VePlayer"].util;
5496
- const DynamicModule$2 = window["VePlayer"].DynamicModule;
5497
- const load$2 = window["VePlayer"].load;
5498
- const Codec$2 = window["VePlayer"].Codec;
5608
+ const DynamicModule$3 = window["VePlayer"].DynamicModule;
5609
+ const load$3 = window["VePlayer"].load;
5610
+ const Codec$3 = window["VePlayer"].Codec;
5499
5611
  const Sniffer$1 = window["VePlayer"].Sniffer;
5500
5612
  const rtmStrategy = {
5501
5613
  options: {},
5502
- module: DynamicModule$2.PluginRtm
5614
+ module: DynamicModule$3.PluginRtm
5503
5615
  };
5504
5616
  const generateFallbackUrl = (url2) => {
5505
5617
  if (Sniffer$1.device === "pc") {
@@ -5531,19 +5643,19 @@ var __publicField = (obj, key, value) => {
5531
5643
  }
5532
5644
  }
5533
5645
  const backupType = actualFallbackUrl && util$1.getStreamType(actualFallbackUrl);
5534
- if (backupType === "flv" && util$1.isMseSupported(Codec$2.H264)) {
5646
+ if (backupType === "flv" && util$1.isMseSupported(Codec$3.H264)) {
5535
5647
  backupStrategy = strategy.createFlvMseStrategy(options);
5536
- } else if (backupType === "hls" && (Sniffer$1.device !== "mobile" || ((_b = options == null ? void 0 : options.hls) == null ? void 0 : _b.enableMSE)) && util$1.isMseSupported(Codec$2.H264)) {
5648
+ } else if (backupType === "hls" && (Sniffer$1.device !== "mobile" || ((_b = options == null ? void 0 : options.hls) == null ? void 0 : _b.enableMSE)) && util$1.isMseSupported(Codec$3.H264)) {
5537
5649
  backupStrategy = strategy.createHlsMseStrategy(options);
5538
5650
  }
5539
5651
  const [rtmCdn, backupCdn] = await Promise.all([
5540
- load$2(rtmStrategy.module).then((module2) => {
5652
+ load$3(rtmStrategy.module).then((module2) => {
5541
5653
  return module2.RtmPlugin;
5542
5654
  }).catch(() => void 0),
5543
- backupStrategy && load$2(backupStrategy.module).then((module2) => {
5544
- if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.PluginFlv) {
5655
+ backupStrategy && load$3(backupStrategy.module).then((module2) => {
5656
+ if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginFlv) {
5545
5657
  return module2.FlvPlugin;
5546
- } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.PluginHls) {
5658
+ } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginHls) {
5547
5659
  return module2.HlsPlugin;
5548
5660
  }
5549
5661
  }).catch(() => void 0)
@@ -5672,6 +5784,9 @@ var __publicField = (obj, key, value) => {
5672
5784
  plugins: []
5673
5785
  };
5674
5786
  }
5787
+ updateDrmConfig() {
5788
+ return void 0;
5789
+ }
5675
5790
  }
5676
5791
  class ProtocolSelector {
5677
5792
  constructor({ queue: queue2, streams, options }) {
@@ -6441,6 +6556,100 @@ var __publicField = (obj, key, value) => {
6441
6556
  })(lodash_merge, lodash_merge.exports);
6442
6557
  var lodash_mergeExports = lodash_merge.exports;
6443
6558
  var merge = /* @__PURE__ */ getDefaultExportFromCjs$1(lodash_mergeExports);
6559
+ const DynamicModule$2 = window["VePlayer"].DynamicModule;
6560
+ const createDashMseStrategy = () => ({
6561
+ options: {},
6562
+ module: DynamicModule$2.PluginDashJs
6563
+ });
6564
+ const Codec$2 = window["VePlayer"].Codec;
6565
+ function isDASHSupported(codec = Codec$2.H264) {
6566
+ return isMMSSupported$2(codec) || isMseSupported$3(codec);
6567
+ }
6568
+ const load$2 = window["VePlayer"].load;
6569
+ class DashProtocol extends BaseProtocol {
6570
+ static get suffix() {
6571
+ return ".mpd";
6572
+ }
6573
+ get protocolType() {
6574
+ return LiveUrlType.Dash;
6575
+ }
6576
+ get defaultFallbackStrategy() {
6577
+ return {};
6578
+ }
6579
+ static canGenerateOtherProtocol() {
6580
+ return true;
6581
+ }
6582
+ static generateUrl(urls, {
6583
+ generateUrlFromOtherProtocol: generateUrlFromOtherProtocol2
6584
+ }) {
6585
+ return urls[LiveUrlType.Dash] ?? generateUrlFromOtherProtocol2();
6586
+ }
6587
+ async canPlay() {
6588
+ return {
6589
+ canPlay: isDASHSupported()
6590
+ };
6591
+ }
6592
+ shouldFallbackWhenStall() {
6593
+ return false;
6594
+ }
6595
+ async getProtocolStrategy(options) {
6596
+ const mseStrategy = createDashMseStrategy();
6597
+ if (!mseStrategy) {
6598
+ return {};
6599
+ }
6600
+ const mseModule = await ((mseStrategy == null ? void 0 : mseStrategy.module) && load$2(mseStrategy.module).catch(() => void 0));
6601
+ return {
6602
+ options: mseStrategy.options,
6603
+ plugins: (mseModule == null ? void 0 : mseModule.DashPlugin) ? [mseModule.DashPlugin] : []
6604
+ };
6605
+ }
6606
+ getAbrStrategy() {
6607
+ return void 0;
6608
+ }
6609
+ getVeStrategy() {
6610
+ return void 0;
6611
+ }
6612
+ async getDrmStrategy(options) {
6613
+ if (!(options == null ? void 0 : options.drm)) {
6614
+ return {};
6615
+ }
6616
+ const dashDrm = this._generateDashDrmConfig(options.drm);
6617
+ return {
6618
+ options: {
6619
+ dash: {
6620
+ ...options.dash,
6621
+ protData: dashDrm
6622
+ }
6623
+ },
6624
+ plugins: []
6625
+ };
6626
+ }
6627
+ updateDrmConfig(drm, player) {
6628
+ var _a, _b;
6629
+ if (!drm) {
6630
+ return;
6631
+ }
6632
+ const dashDrm = this._generateDashDrmConfig(drm);
6633
+ const dashPlugin = (_b = (_a = player == null ? void 0 : player._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.dash;
6634
+ if (dashPlugin) {
6635
+ dashPlugin.protData = dashDrm;
6636
+ }
6637
+ }
6638
+ _generateDashDrmConfig(drm) {
6639
+ return Object.keys(drm).reduce((pre, cur) => {
6640
+ var _a;
6641
+ const keyName = KeyNameMap[cur];
6642
+ if (keyName) {
6643
+ pre[keyName] = {
6644
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6645
+ // @ts-ignore
6646
+ serverURL: (_a = drm == null ? void 0 : drm[cur]) == null ? void 0 : _a.serverProcessSPCPath
6647
+ };
6648
+ }
6649
+ return pre;
6650
+ }, {});
6651
+ }
6652
+ }
6444
6653
  const _ProtocolManager = class {
6445
6654
  constructor(options) {
6446
6655
  __publicField(this, "_options");
@@ -6595,7 +6804,8 @@ var __publicField = (obj, key, value) => {
6595
6804
  [LiveUrlType.LLFlv]: FlvLowLatencyProtocol,
6596
6805
  [LiveUrlType.Hls]: HlsProtocol,
6597
6806
  [LiveUrlType.LLHls]: HlsLowLatencyProtocol,
6598
- [LiveUrlType.Rtm]: RtmProtocol
6807
+ [LiveUrlType.Rtm]: RtmProtocol,
6808
+ [LiveUrlType.Dash]: DashProtocol
6599
6809
  });
6600
6810
  class Fallback {
6601
6811
  constructor() {
@@ -24338,9 +24548,9 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
24338
24548
  * @brief Use this method to update DRM configuration.
24339
24549
  * @param config A configuration object containing settings for Fairplay DRM.
24340
24550
  */
24341
- updateDrmConfig(config2) {
24342
- var _a, _b, _c;
24343
- (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config2);
24551
+ async updateDrmConfig(config2) {
24552
+ var _a, _b;
24553
+ return (_b = (_a = this._protocolManager) == null ? void 0 : _a.protocol) == null ? void 0 : _b.updateDrmConfig(config2, this);
24344
24554
  }
24345
24555
  /** {zh}
24346
24556
  * @brief 修改 ABR 配置,包含修改是否开启 ABR 功能,和修改其他清晰度。