@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.
@@ -6543,11 +6543,20 @@ var __publicField = (obj, key, value) => {
6543
6543
  ErrorCode2[ErrorCode2["MEDIA_MSE_HIJACK"] = 5204] = "MEDIA_MSE_HIJACK";
6544
6544
  ErrorCode2[ErrorCode2["MEDIA_EME_HIJACK"] = 5301] = "MEDIA_EME_HIJACK";
6545
6545
  ErrorCode2[ErrorCode2["DRM_LICENSE"] = 7100] = "DRM_LICENSE";
6546
+ ErrorCode2[ErrorCode2["DRM_UNSUPPORTED"] = 7101] = "DRM_UNSUPPORTED";
6547
+ ErrorCode2[ErrorCode2["DRM_NO_MEDIA_KEY"] = 7103] = "DRM_NO_MEDIA_KEY";
6548
+ ErrorCode2[ErrorCode2["DRM_NO_KEY_SESSION"] = 7104] = "DRM_NO_KEY_SESSION";
6549
+ ErrorCode2[ErrorCode2["DRM_GENERATE_QUEST_FAIL"] = 7105] = "DRM_GENERATE_QUEST_FAIL";
6550
+ ErrorCode2[ErrorCode2["DRM_LACK_SERVER_CERTIFICATE_PATH"] = 7106] = "DRM_LACK_SERVER_CERTIFICATE_PATH";
6551
+ ErrorCode2[ErrorCode2["DRM_LACK_SERVER_PROCESS_SPC_PATH"] = 7107] = "DRM_LACK_SERVER_PROCESS_SPC_PATH";
6552
+ ErrorCode2[ErrorCode2["DRM_LICENSE_FAIL"] = 7108] = "DRM_LICENSE_FAIL";
6553
+ ErrorCode2[ErrorCode2["DRM_KEY_ERROR"] = 7109] = "DRM_KEY_ERROR";
6554
+ ErrorCode2[ErrorCode2["DRM_CERT_FAIL"] = 7110] = "DRM_CERT_FAIL";
6546
6555
  ErrorCode2[ErrorCode2["DRM_CUSTOM_LICENSE"] = 7200] = "DRM_CUSTOM_LICENSE";
6547
6556
  ErrorCode2[ErrorCode2["OTHER"] = 8e3] = "OTHER";
6548
6557
  ErrorCode2[ErrorCode2["RUNTIME_NO_CANPLAY_ERROR"] = 9001] = "RUNTIME_NO_CANPLAY_ERROR";
6549
6558
  ErrorCode2[ErrorCode2["RUNTIME_BUFFERBREAK_ERROR"] = 9002] = "RUNTIME_BUFFERBREAK_ERROR";
6550
- ErrorCode2[ErrorCode2["RUNTIME_BWAITING_TIMEOUT_ERROR"] = 9002] = "RUNTIME_BWAITING_TIMEOUT_ERROR";
6559
+ ErrorCode2[ErrorCode2["RUNTIME_WAITING_TIMEOUT_ERROR"] = 9003] = "RUNTIME_WAITING_TIMEOUT_ERROR";
6551
6560
  ErrorCode2[ErrorCode2["MODULE_LOAD_ERROR"] = 110] = "MODULE_LOAD_ERROR";
6552
6561
  ErrorCode2["UNKNOWN"] = "UNKNOWN";
6553
6562
  return ErrorCode2;
@@ -6659,6 +6668,78 @@ var __publicField = (obj, key, value) => {
6659
6668
  messageTextKey: "DRM_LICENSE",
6660
6669
  level: "Fatal"
6661
6670
  /* Fatal */
6671
+ },
6672
+ [
6673
+ 7101
6674
+ /* DRM_UNSUPPORTED */
6675
+ ]: {
6676
+ messageTextKey: "DRM_UNSUPPORTED",
6677
+ level: "Fatal"
6678
+ /* Fatal */
6679
+ },
6680
+ [
6681
+ 7103
6682
+ /* DRM_NO_MEDIA_KEY */
6683
+ ]: {
6684
+ messageTextKey: "DRM_NO_MEDIA_KEY",
6685
+ level: "Fatal"
6686
+ /* Fatal */
6687
+ },
6688
+ [
6689
+ 7104
6690
+ /* DRM_NO_KEY_SESSION */
6691
+ ]: {
6692
+ messageTextKey: "DRM_NO_KEY_SESSION",
6693
+ level: "Fatal"
6694
+ /* Fatal */
6695
+ },
6696
+ [
6697
+ 7105
6698
+ /* DRM_GENERATE_QUEST_FAIL */
6699
+ ]: {
6700
+ messageTextKey: "DRM_GENERATE_QUEST_FAIL",
6701
+ level: "Fatal"
6702
+ /* Fatal */
6703
+ },
6704
+ [
6705
+ 7106
6706
+ /* DRM_LACK_SERVER_CERTIFICATE_PATH */
6707
+ ]: {
6708
+ messageTextKey: "DRM_LACK_SERVER_CERTIFICATE_PATH",
6709
+ level: "Fatal"
6710
+ /* Fatal */
6711
+ },
6712
+ [
6713
+ 7107
6714
+ /* DRM_LACK_SERVER_PROCESS_SPC_PATH */
6715
+ ]: {
6716
+ messageTextKey: "DRM_LACK_SERVER_PROCESS_SPC_PATH",
6717
+ level: "Fatal"
6718
+ /* Fatal */
6719
+ },
6720
+ [
6721
+ 7108
6722
+ /* DRM_LICENSE_FAIL */
6723
+ ]: {
6724
+ messageTextKey: "DRM_LICENSE_FAIL",
6725
+ level: "Fatal"
6726
+ /* Fatal */
6727
+ },
6728
+ [
6729
+ 7109
6730
+ /* DRM_KEY_ERROR */
6731
+ ]: {
6732
+ messageTextKey: "DRM_KEY_ERROR",
6733
+ level: "Fatal"
6734
+ /* Fatal */
6735
+ },
6736
+ [
6737
+ 7110
6738
+ /* DRM_CERT_FAIL */
6739
+ ]: {
6740
+ messageTextKey: "DRM_CERT_FAIL",
6741
+ level: "Fatal"
6742
+ /* Fatal */
6662
6743
  }
6663
6744
  };
6664
6745
  const ERROR_TYPE_INFO = {
@@ -12721,6 +12802,7 @@ var __publicField = (obj, key, value) => {
12721
12802
  "plugin:mp4": "veplayer.plugin.mp4.[env].[ext]",
12722
12803
  "plugin:hls": "veplayer.plugin.hls.[env].[ext]",
12723
12804
  "plugin:hlsjs": "veplayer.plugin.hlsjs.[env].[ext]",
12805
+ "plugin:dashjs": "veplayer.plugin.dashjs.[env].[ext]",
12724
12806
  "plugin:shaka": "veplayer.plugin.shaka.[env].[ext]",
12725
12807
  "plugin:rtm": "veplayer.plugin.rtm.[env].[ext]",
12726
12808
  "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]",
@@ -12736,6 +12818,7 @@ var __publicField = (obj, key, value) => {
12736
12818
  DynamicModule2["PluginMp4"] = "plugin:mp4";
12737
12819
  DynamicModule2["PluginHls"] = "plugin:hls";
12738
12820
  DynamicModule2["PluginHlsJs"] = "plugin:hlsjs";
12821
+ DynamicModule2["PluginDashJs"] = "plugin:dashjs";
12739
12822
  DynamicModule2["PluginShaka"] = "plugin:shaka";
12740
12823
  DynamicModule2["PluginRtm"] = "plugin:rtm";
12741
12824
  DynamicModule2["PluginXgvideo"] = "plugin:xgvideo";
@@ -14080,6 +14163,15 @@ var __publicField = (obj, key, value) => {
14080
14163
  MEDIA_ERR_URL_EMPTY: "The stream address is not specified",
14081
14164
  DRM: "Permission verification failed",
14082
14165
  DRM_LICENSE: "Commercial DRM Permission verification failed",
14166
+ DRM_UNSUPPORTED: "DRM encrypted playback is not supported",
14167
+ DRM_NO_MEDIA_KEY: "Video data lacks the corresponding MediaKey",
14168
+ DRM_NO_KEY_SESSION: "Browser does not support the corresponding DRM KeySession",
14169
+ DRM_GENERATE_QUEST_FAIL: "Decryption playback error",
14170
+ DRM_LACK_SERVER_CERTIFICATE_PATH: "Missing DRM certificate request link",
14171
+ DRM_LACK_SERVER_PROCESS_SPC_PATH: "Missing DRM License request link",
14172
+ DRM_LICENSE_FAIL: "Request or update License failed",
14173
+ DRM_KEY_ERROR: "Decryption error",
14174
+ DRM_CERT_FAIL: "Request for DRM certificate failed",
14083
14175
  OTHER: "Unknown error",
14084
14176
  RUNTIME: "An error occurred, Please try again",
14085
14177
  MODULE_LOAD_ERROR: "CDN fetch error",
@@ -14107,6 +14199,15 @@ var __publicField = (obj, key, value) => {
14107
14199
  MEDIA_ERR_URL_EMPTY: "当前播放地址为空",
14108
14200
  DRM: "权限验证失败",
14109
14201
  DRM_LICENSE: "商业 DRM LICENSE 鉴权失败",
14202
+ DRM_UNSUPPORTED: "不支持 DRM 加密播放",
14203
+ DRM_NO_MEDIA_KEY: "视频数据缺少相应 MediaKey",
14204
+ DRM_NO_KEY_SESSION: "浏览器不支持相应 DRM KeySession",
14205
+ DRM_GENERATE_QUEST_FAIL: "解密播放错误",
14206
+ DRM_LACK_SERVER_CERTIFICATE_PATH: "缺少 DRM 证书请求链接",
14207
+ DRM_LACK_SERVER_PROCESS_SPC_PATH: "缺少 DRM License 请求链接",
14208
+ DRM_LICENSE_FAIL: "请求或更新 License 失败",
14209
+ DRM_KEY_ERROR: "解密错误",
14210
+ DRM_CERT_FAIL: "请求 DRM 证书失败",
14110
14211
  OTHER: "其他报错",
14111
14212
  RUNTIME: "播放异常,请重试",
14112
14213
  MODULE_LOAD_ERROR: "插件模块加载异常",
@@ -14203,10 +14304,15 @@ var __publicField = (obj, key, value) => {
14203
14304
  * @param options 更多配置信息。
14204
14305
  */
14205
14306
  (options) => {
14307
+ var _a, _b;
14206
14308
  const { autoplay: autoplay2, ...rest } = options;
14207
14309
  const xgOptions = rest;
14208
14310
  if (xgOptions.poster) {
14209
- xgOptions.poster = escapeHtml(xgOptions.poster);
14311
+ if (typeof xgOptions.poster === "string") {
14312
+ xgOptions.poster = escapeHtml(xgOptions.poster);
14313
+ } else if (typeof ((_a = xgOptions.poster) == null ? void 0 : _a.poster) === "string") {
14314
+ xgOptions.poster.poster = escapeHtml((_b = xgOptions.poster) == null ? void 0 : _b.poster);
14315
+ }
14210
14316
  }
14211
14317
  xgOptions.icons = {
14212
14318
  ...DEFAULT_ICONS,
@@ -14458,7 +14564,7 @@ var __publicField = (obj, key, value) => {
14458
14564
  * @brief Retrieve the player SDK version number.
14459
14565
  */
14460
14566
  get playerVersion() {
14461
- return "2.8.0-rc.2";
14567
+ return "2.8.0";
14462
14568
  }
14463
14569
  /** {zh}
14464
14570
  * @brief 获取当前播放视频的清晰度唯一标识(definition)。
@@ -14979,7 +15085,9 @@ var __publicField = (obj, key, value) => {
14979
15085
  if (!url2) {
14980
15086
  const transformedError = transform$1(err, this._i18nManager);
14981
15087
  try {
14982
- const { canEmitError } = await this._beforeFallbackError(transformedError);
15088
+ const { canEmitError } = await this._beforeFallbackError(
15089
+ transformedError
15090
+ );
14983
15091
  if (!canEmitError) {
14984
15092
  return;
14985
15093
  }
@@ -15015,7 +15123,7 @@ var __publicField = (obj, key, value) => {
15015
15123
  return transform(event, callback);
15016
15124
  }
15017
15125
  async _switch(targetDefinition) {
15018
- var _a, _b, _c, _d, _e2, _f;
15126
+ var _a, _b, _c, _d, _e2, _f, _g, _h;
15019
15127
  const preDefinition = clonedeep(this._sourceManager.definition);
15020
15128
  const isPaused = this._player.paused && !this._player.isError;
15021
15129
  const {
@@ -15028,9 +15136,9 @@ var __publicField = (obj, key, value) => {
15028
15136
  targetDefinition.url = options == null ? void 0 : options.url;
15029
15137
  }
15030
15138
  this._sourceManager.switch(targetDefinition);
15031
- (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.sources.renderItemList();
15032
- (_d = (_c = this._player) == null ? void 0 : _c.plugins) == null ? void 0 : _d.definition.renderItemList();
15033
- const isSourceSwitching = ((_e2 = targetDefinition == null ? void 0 : targetDefinition.source) == null ? void 0 : _e2.name) !== ((_f = preDefinition == null ? void 0 : preDefinition.source) == null ? void 0 : _f.name);
15139
+ (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.sources) == null ? void 0 : _c.renderItemList();
15140
+ (_f = (_e2 = (_d = this._player) == null ? void 0 : _d.plugins) == null ? void 0 : _e2.definition) == null ? void 0 : _f.renderItemList();
15141
+ const isSourceSwitching = ((_g = targetDefinition == null ? void 0 : targetDefinition.source) == null ? void 0 : _g.name) !== ((_h = preDefinition == null ? void 0 : preDefinition.source) == null ? void 0 : _h.name);
15034
15142
  this._player.config.url = targetDefinition.url;
15035
15143
  if (isSameProtocol) {
15036
15144
  if (isSourceSwitching) {
@@ -21943,10 +22051,10 @@ var __publicField = (obj, key, value) => {
21943
22051
  device_id: (_f = (_e2 = this.player.config) == null ? void 0 : _e2.teaTracker) == null ? void 0 : _f.deviceId,
21944
22052
  error_report_stop: true,
21945
22053
  ext: {
21946
- veplayer_version: "2.8.0-rc.2",
22054
+ veplayer_version: "2.8.0",
21947
22055
  flv_version: "3.0.21-rc.21",
21948
22056
  hls_version: "3.0.21-rc.21",
21949
- rts_version: "0.2.1-alpha.30"
22057
+ rts_version: "0.2.1-alpha.35"
21950
22058
  }
21951
22059
  });
21952
22060
  }
@@ -22320,7 +22428,22 @@ var __publicField = (obj, key, value) => {
22320
22428
  LLHls: "ll-hls",
22321
22429
  Flv: "flv",
22322
22430
  Rtm: "rtm",
22323
- LLFlv: "ll-flv"
22431
+ LLFlv: "ll-flv",
22432
+ Dash: "dash"
22433
+ };
22434
+ const KeyNameMap = {
22435
+ [
22436
+ "widevine"
22437
+ /* Widevine */
22438
+ ]: "com.widevine.alpha",
22439
+ [
22440
+ "playready"
22441
+ /* Playready */
22442
+ ]: "com.microsoft.playready",
22443
+ [
22444
+ "fairplay"
22445
+ /* Fairplay */
22446
+ ]: "com.apple.fps"
22324
22447
  };
22325
22448
  const { isMMSSupported: isMMSSupported$1, isMseSupported: isMseSupported$2 } = util;
22326
22449
  function enableMMS() {
@@ -22484,6 +22607,9 @@ var __publicField = (obj, key, value) => {
22484
22607
  getVeStrategy() {
22485
22608
  return void 0;
22486
22609
  }
22610
+ updateDrmConfig() {
22611
+ return void 0;
22612
+ }
22487
22613
  }
22488
22614
  class FlvLowLatencyProtocol extends FlvProtocol {
22489
22615
  get protocolType() {
@@ -22499,47 +22625,54 @@ var __publicField = (obj, key, value) => {
22499
22625
  });
22500
22626
  }
22501
22627
  }
22502
- var DrmType = /* @__PURE__ */ ((DrmType2) => {
22503
- DrmType2["Fairplay"] = "fairplay";
22504
- return DrmType2;
22505
- })(DrmType || {});
22506
- function getDrmType(drm) {
22507
- if ((drm == null ? void 0 : drm.fairplay) && (sniffer$1.browser === "safari" || sniffer$1.os.isIos)) {
22508
- return "fairplay";
22509
- }
22510
- return;
22628
+ function preferNativeForFairplay(options) {
22629
+ var _a;
22630
+ return ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) && (sniffer$1.browser === "safari" || sniffer$1.os.isIos);
22511
22631
  }
22512
- function isMseSupportedWithDrm({
22513
- drm,
22514
- streamType
22515
- }) {
22516
- const drmType = getDrmType(drm);
22517
- if (!drmType) {
22518
- return true;
22519
- }
22520
- if (drmType === "fairplay" && streamType === "hls") {
22632
+ function enableMse(options) {
22633
+ var _a;
22634
+ if (preferNativeForFairplay(options)) {
22521
22635
  return false;
22522
22636
  }
22523
- return true;
22637
+ return sniffer$1.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE);
22524
22638
  }
22525
- const { isMseSupported: isMseSupported$1 } = util;
22526
22639
  function enableHlsJs(options) {
22527
- var _a, _b;
22528
- if ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableHlsJs) {
22640
+ var _a, _b, _c;
22641
+ if (typeof ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableHlsJs) !== "undefined") {
22642
+ return (_b = options.hls) == null ? void 0 : _b.enableHlsJs;
22643
+ }
22644
+ if (((_c = options == null ? void 0 : options.ad) == null ? void 0 : _c.adType) === "ssai") {
22529
22645
  return true;
22530
22646
  }
22531
- if (((_b = options == null ? void 0 : options.ad) == null ? void 0 : _b.adType) === "ssai") {
22647
+ if (options.drm) {
22532
22648
  return true;
22533
22649
  }
22534
22650
  return false;
22535
22651
  }
22652
+ function transformHlsDrmConfig(drmConfig) {
22653
+ const drmSystems = {};
22654
+ for (const key in drmConfig) {
22655
+ if (drmConfig.hasOwnProperty(key)) {
22656
+ const drmSystemKey = KeyNameMap[key];
22657
+ const drmSystemUrls = drmConfig[key];
22658
+ if (drmSystemKey && drmSystemUrls) {
22659
+ drmSystems[drmSystemKey] = {
22660
+ licenseUrl: drmSystemUrls == null ? void 0 : drmSystemUrls.serverProcessSPCPath,
22661
+ serverCertificateUrl: drmSystemUrls == null ? void 0 : drmSystemUrls.serverCertificatePath
22662
+ };
22663
+ }
22664
+ }
22665
+ }
22666
+ return {
22667
+ emeEnabled: true,
22668
+ drmSystems
22669
+ };
22670
+ }
22671
+ const { isMseSupported: isMseSupported$1 } = util;
22536
22672
  const getHlsStrategy = async (options) => {
22537
- var _a, _b;
22673
+ var _a;
22538
22674
  let mseStrategy;
22539
22675
  let softStrategy;
22540
- if (!isMseSupportedWithDrm({ drm: options.drm, streamType: "hls" })) {
22541
- return { options: {}, plugins: [] };
22542
- }
22543
22676
  const codec = await getCodec(options);
22544
22677
  const isSoftDecode$1 = await isSoftDecode(options, codec);
22545
22678
  const useHlsJs = enableHlsJs(options);
@@ -22547,7 +22680,7 @@ var __publicField = (obj, key, value) => {
22547
22680
  softStrategy = codec === Codec$1.H265 ? createSoftDecodeH265Strategy() : createSoftDecodeH264Strategy();
22548
22681
  mseStrategy = createHlsMseStrategy(options, useHlsJs);
22549
22682
  }
22550
- if ((sniffer$1.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && (codec === "unknown" ? isMseSupported$1(Codec$1.H264) : isMseSupported$1(codec))) {
22683
+ if (enableMse(options) && (codec === "unknown" ? isMseSupported$1(Codec$1.H264) : isMseSupported$1(codec))) {
22551
22684
  mseStrategy = createHlsMseStrategy(options, useHlsJs);
22552
22685
  }
22553
22686
  if (!mseStrategy && !softStrategy) {
@@ -22557,7 +22690,7 @@ var __publicField = (obj, key, value) => {
22557
22690
  (mseStrategy == null ? void 0 : mseStrategy.module) && load(mseStrategy.module).catch(() => void 0),
22558
22691
  (softStrategy == null ? void 0 : softStrategy.module) && load(softStrategy.module).catch(() => void 0)
22559
22692
  ]);
22560
- (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));
22693
+ (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));
22561
22694
  const combineOptions$1 = combineOptions([mseStrategy, softStrategy]);
22562
22695
  return {
22563
22696
  options: combineOptions$1,
@@ -22628,37 +22761,6 @@ var __publicField = (obj, key, value) => {
22628
22761
  });
22629
22762
  return newPlaylist;
22630
22763
  }
22631
- const getDrmStrategy = async (options, player) => {
22632
- var _a;
22633
- const drmType = getDrmType(options.drm);
22634
- if (options.url && drmType === DrmType.Fairplay) {
22635
- try {
22636
- const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
22637
- const [drmPlugin, drmConfig] = await Promise.all([
22638
- load(DynamicModule.PluginDrm).then((module2) => module2.DrmPlugin).catch(() => void 0),
22639
- getDrmConfig == null ? void 0 : getDrmConfig({
22640
- url: options.url
22641
- })
22642
- ]);
22643
- const fairplayDrmConfig = Object.assign(
22644
- {},
22645
- originFairplayConfig,
22646
- options == null ? void 0 : options.drm,
22647
- drmConfig
22648
- );
22649
- drmConfig && (player == null ? void 0 : player.updateDrmConfig(drmConfig));
22650
- return {
22651
- options: {
22652
- drm: fairplayDrmConfig
22653
- },
22654
- plugins: drmPlugin ? [drmPlugin] : []
22655
- };
22656
- } catch (error2) {
22657
- console.log(error2);
22658
- }
22659
- }
22660
- return {};
22661
- };
22662
22764
  class HlsProtocol extends BaseProtocol {
22663
22765
  static get suffix() {
22664
22766
  return ".m3u8";
@@ -22715,14 +22817,58 @@ var __publicField = (obj, key, value) => {
22715
22817
  plugins: [abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin]
22716
22818
  };
22717
22819
  }
22718
- getDrmStrategy(options, { player }) {
22719
- return getDrmStrategy(options, player);
22820
+ async updateDrmConfig(drmConfig, player) {
22821
+ var _a, _b, _c, _d;
22822
+ if (!drmConfig) {
22823
+ return;
22824
+ }
22825
+ const drmPlugin = (_b = (_a = player == null ? void 0 : player._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm;
22826
+ const hlsPlugin = (_d = (_c = player == null ? void 0 : player._player) == null ? void 0 : _c.plugins) == null ? void 0 : _d.hls;
22827
+ if (drmPlugin) {
22828
+ drmPlugin.restart();
22829
+ return drmPlugin.updateConfig(drmConfig);
22830
+ } else if (hlsPlugin) {
22831
+ hlsPlugin.config = {
22832
+ ...hlsPlugin.config,
22833
+ ...transformHlsDrmConfig(drmConfig)
22834
+ };
22835
+ }
22836
+ }
22837
+ async getDrmStrategy(options, { player }) {
22838
+ try {
22839
+ if (!(options == null ? void 0 : options.drm)) {
22840
+ return { options: {}, plugins: [] };
22841
+ }
22842
+ const drmConfig = (options == null ? void 0 : options.drm) ?? {};
22843
+ if (!preferNativeForFairplay(options) && enableHlsJs(options)) {
22844
+ return {
22845
+ options: {
22846
+ hls: {
22847
+ ...options.hls,
22848
+ ...transformHlsDrmConfig(drmConfig)
22849
+ }
22850
+ },
22851
+ plugins: []
22852
+ };
22853
+ }
22854
+ const drmPlugin = await load(DynamicModule.PluginDrm).then((module2) => module2.DrmPlugin).catch(() => void 0);
22855
+ drmConfig && await (player == null ? void 0 : player.updateDrmConfig(drmConfig));
22856
+ return {
22857
+ options: {
22858
+ drm: drmConfig
22859
+ },
22860
+ plugins: drmPlugin ? [drmPlugin] : []
22861
+ };
22862
+ } catch (error2) {
22863
+ console.log(error2);
22864
+ }
22865
+ return {};
22720
22866
  }
22721
22867
  getVeStrategy() {
22722
22868
  return void 0;
22723
22869
  }
22724
22870
  }
22725
- class HlsLowLatencyProtocol extends BaseProtocol {
22871
+ class HlsLowLatencyProtocol extends HlsProtocol {
22726
22872
  static get suffix() {
22727
22873
  return ".m3u8";
22728
22874
  }
@@ -22747,12 +22893,6 @@ var __publicField = (obj, key, value) => {
22747
22893
  async getProtocolStrategy(options) {
22748
22894
  return getHlsStrategy(options);
22749
22895
  }
22750
- getAbrStrategy() {
22751
- return void 0;
22752
- }
22753
- getDrmStrategy() {
22754
- return void 0;
22755
- }
22756
22896
  getVeStrategy() {
22757
22897
  return void 0;
22758
22898
  }
@@ -22942,6 +23082,9 @@ var __publicField = (obj, key, value) => {
22942
23082
  plugins: []
22943
23083
  };
22944
23084
  }
23085
+ updateDrmConfig() {
23086
+ return void 0;
23087
+ }
22945
23088
  }
22946
23089
  class ProtocolSelector {
22947
23090
  constructor({ queue: queue2, streams, options }) {
@@ -23711,6 +23854,97 @@ var __publicField = (obj, key, value) => {
23711
23854
  })(lodash_merge, lodash_merge.exports);
23712
23855
  var lodash_mergeExports = lodash_merge.exports;
23713
23856
  var merge = /* @__PURE__ */ getDefaultExportFromCjs$1(lodash_mergeExports);
23857
+ const createDashMseStrategy = () => ({
23858
+ options: {},
23859
+ module: DynamicModule.PluginDashJs
23860
+ });
23861
+ function isDASHSupported(codec = Codec$1.H264) {
23862
+ return isMMSSupported$2(codec) || isMseSupported$3(codec);
23863
+ }
23864
+ class DashProtocol extends BaseProtocol {
23865
+ static get suffix() {
23866
+ return ".mpd";
23867
+ }
23868
+ get protocolType() {
23869
+ return LiveUrlType.Dash;
23870
+ }
23871
+ get defaultFallbackStrategy() {
23872
+ return {};
23873
+ }
23874
+ static canGenerateOtherProtocol() {
23875
+ return true;
23876
+ }
23877
+ static generateUrl(urls, {
23878
+ generateUrlFromOtherProtocol: generateUrlFromOtherProtocol2
23879
+ }) {
23880
+ return urls[LiveUrlType.Dash] ?? generateUrlFromOtherProtocol2();
23881
+ }
23882
+ async canPlay() {
23883
+ return {
23884
+ canPlay: isDASHSupported()
23885
+ };
23886
+ }
23887
+ shouldFallbackWhenStall() {
23888
+ return false;
23889
+ }
23890
+ async getProtocolStrategy(options) {
23891
+ const mseStrategy = createDashMseStrategy();
23892
+ if (!mseStrategy) {
23893
+ return {};
23894
+ }
23895
+ const mseModule = await ((mseStrategy == null ? void 0 : mseStrategy.module) && load(mseStrategy.module).catch(() => void 0));
23896
+ return {
23897
+ options: mseStrategy.options,
23898
+ plugins: (mseModule == null ? void 0 : mseModule.DashPlugin) ? [mseModule.DashPlugin] : []
23899
+ };
23900
+ }
23901
+ getAbrStrategy() {
23902
+ return void 0;
23903
+ }
23904
+ getVeStrategy() {
23905
+ return void 0;
23906
+ }
23907
+ async getDrmStrategy(options) {
23908
+ if (!(options == null ? void 0 : options.drm)) {
23909
+ return {};
23910
+ }
23911
+ const dashDrm = this._generateDashDrmConfig(options.drm);
23912
+ return {
23913
+ options: {
23914
+ dash: {
23915
+ ...options.dash,
23916
+ protData: dashDrm
23917
+ }
23918
+ },
23919
+ plugins: []
23920
+ };
23921
+ }
23922
+ updateDrmConfig(drm, player) {
23923
+ var _a, _b;
23924
+ if (!drm) {
23925
+ return;
23926
+ }
23927
+ const dashDrm = this._generateDashDrmConfig(drm);
23928
+ const dashPlugin = (_b = (_a = player == null ? void 0 : player._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.dash;
23929
+ if (dashPlugin) {
23930
+ dashPlugin.protData = dashDrm;
23931
+ }
23932
+ }
23933
+ _generateDashDrmConfig(drm) {
23934
+ return Object.keys(drm).reduce((pre, cur) => {
23935
+ var _a;
23936
+ const keyName = KeyNameMap[cur];
23937
+ if (keyName) {
23938
+ pre[keyName] = {
23939
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
23940
+ // @ts-ignore
23941
+ serverURL: (_a = drm == null ? void 0 : drm[cur]) == null ? void 0 : _a.serverProcessSPCPath
23942
+ };
23943
+ }
23944
+ return pre;
23945
+ }, {});
23946
+ }
23947
+ }
23714
23948
  const _ProtocolManager = class {
23715
23949
  constructor(options) {
23716
23950
  __publicField(this, "_options");
@@ -23865,7 +24099,8 @@ var __publicField = (obj, key, value) => {
23865
24099
  [LiveUrlType.LLFlv]: FlvLowLatencyProtocol,
23866
24100
  [LiveUrlType.Hls]: HlsProtocol,
23867
24101
  [LiveUrlType.LLHls]: HlsLowLatencyProtocol,
23868
- [LiveUrlType.Rtm]: RtmProtocol
24102
+ [LiveUrlType.Rtm]: RtmProtocol,
24103
+ [LiveUrlType.Dash]: DashProtocol
23869
24104
  });
23870
24105
  class Fallback {
23871
24106
  constructor() {
@@ -41603,9 +41838,9 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
41603
41838
  * @brief Use this method to update DRM configuration.
41604
41839
  * @param config A configuration object containing settings for Fairplay DRM.
41605
41840
  */
41606
- updateDrmConfig(config2) {
41607
- var _a, _b, _c;
41608
- (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config2);
41841
+ async updateDrmConfig(config2) {
41842
+ var _a, _b;
41843
+ return (_b = (_a = this._protocolManager) == null ? void 0 : _a.protocol) == null ? void 0 : _b.updateDrmConfig(config2, this);
41609
41844
  }
41610
41845
  /** {zh}
41611
41846
  * @brief 修改 ABR 配置,包含修改是否开启 ABR 功能,和修改其他清晰度。