@volcengine/veplayer 2.8.0-rc.1 → 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.1";
14567
+ return "2.8.0";
14462
14568
  }
14463
14569
  /** {zh}
14464
14570
  * @brief 获取当前播放视频的清晰度唯一标识(definition)。
@@ -14733,7 +14839,7 @@ var __publicField = (obj, key, value) => {
14733
14839
  }
14734
14840
  }
14735
14841
  /** {zh}
14736
- * @brief 调用此方法开始播放 。
14842
+ * @brief 调用此方法开始播放。
14737
14843
  */
14738
14844
  /** {en}
14739
14845
  * @brief Starts playback.
@@ -15017,7 +15123,7 @@ var __publicField = (obj, key, value) => {
15017
15123
  return transform(event, callback);
15018
15124
  }
15019
15125
  async _switch(targetDefinition) {
15020
- var _a, _b, _c, _d, _e2, _f;
15126
+ var _a, _b, _c, _d, _e2, _f, _g, _h;
15021
15127
  const preDefinition = clonedeep(this._sourceManager.definition);
15022
15128
  const isPaused = this._player.paused && !this._player.isError;
15023
15129
  const {
@@ -15030,9 +15136,9 @@ var __publicField = (obj, key, value) => {
15030
15136
  targetDefinition.url = options == null ? void 0 : options.url;
15031
15137
  }
15032
15138
  this._sourceManager.switch(targetDefinition);
15033
- (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.sources.renderItemList();
15034
- (_d = (_c = this._player) == null ? void 0 : _c.plugins) == null ? void 0 : _d.definition.renderItemList();
15035
- 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);
15036
15142
  this._player.config.url = targetDefinition.url;
15037
15143
  if (isSameProtocol) {
15038
15144
  if (isSourceSwitching) {
@@ -21945,10 +22051,10 @@ var __publicField = (obj, key, value) => {
21945
22051
  device_id: (_f = (_e2 = this.player.config) == null ? void 0 : _e2.teaTracker) == null ? void 0 : _f.deviceId,
21946
22052
  error_report_stop: true,
21947
22053
  ext: {
21948
- veplayer_version: "2.8.0-rc.1",
22054
+ veplayer_version: "2.8.0",
21949
22055
  flv_version: "3.0.21-rc.21",
21950
22056
  hls_version: "3.0.21-rc.21",
21951
- rts_version: "0.2.1-alpha.29"
22057
+ rts_version: "0.2.1-alpha.35"
21952
22058
  }
21953
22059
  });
21954
22060
  }
@@ -22322,7 +22428,22 @@ var __publicField = (obj, key, value) => {
22322
22428
  LLHls: "ll-hls",
22323
22429
  Flv: "flv",
22324
22430
  Rtm: "rtm",
22325
- 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"
22326
22447
  };
22327
22448
  const { isMMSSupported: isMMSSupported$1, isMseSupported: isMseSupported$2 } = util;
22328
22449
  function enableMMS() {
@@ -22486,6 +22607,9 @@ var __publicField = (obj, key, value) => {
22486
22607
  getVeStrategy() {
22487
22608
  return void 0;
22488
22609
  }
22610
+ updateDrmConfig() {
22611
+ return void 0;
22612
+ }
22489
22613
  }
22490
22614
  class FlvLowLatencyProtocol extends FlvProtocol {
22491
22615
  get protocolType() {
@@ -22501,47 +22625,54 @@ var __publicField = (obj, key, value) => {
22501
22625
  });
22502
22626
  }
22503
22627
  }
22504
- var DrmType = /* @__PURE__ */ ((DrmType2) => {
22505
- DrmType2["Fairplay"] = "fairplay";
22506
- return DrmType2;
22507
- })(DrmType || {});
22508
- function getDrmType(drm) {
22509
- if ((drm == null ? void 0 : drm.fairplay) && (sniffer$1.browser === "safari" || sniffer$1.os.isIos)) {
22510
- return "fairplay";
22511
- }
22512
- 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);
22513
22631
  }
22514
- function isMseSupportedWithDrm({
22515
- drm,
22516
- streamType
22517
- }) {
22518
- const drmType = getDrmType(drm);
22519
- if (!drmType) {
22520
- return true;
22521
- }
22522
- if (drmType === "fairplay" && streamType === "hls") {
22632
+ function enableMse(options) {
22633
+ var _a;
22634
+ if (preferNativeForFairplay(options)) {
22523
22635
  return false;
22524
22636
  }
22525
- return true;
22637
+ return sniffer$1.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE);
22526
22638
  }
22527
- const { isMseSupported: isMseSupported$1 } = util;
22528
22639
  function enableHlsJs(options) {
22529
- var _a, _b;
22530
- 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") {
22531
22645
  return true;
22532
22646
  }
22533
- if (((_b = options == null ? void 0 : options.ad) == null ? void 0 : _b.adType) === "ssai") {
22647
+ if (options.drm) {
22534
22648
  return true;
22535
22649
  }
22536
22650
  return false;
22537
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;
22538
22672
  const getHlsStrategy = async (options) => {
22539
- var _a, _b;
22673
+ var _a;
22540
22674
  let mseStrategy;
22541
22675
  let softStrategy;
22542
- if (!isMseSupportedWithDrm({ drm: options.drm, streamType: "hls" })) {
22543
- return { options: {}, plugins: [] };
22544
- }
22545
22676
  const codec = await getCodec(options);
22546
22677
  const isSoftDecode$1 = await isSoftDecode(options, codec);
22547
22678
  const useHlsJs = enableHlsJs(options);
@@ -22549,7 +22680,7 @@ var __publicField = (obj, key, value) => {
22549
22680
  softStrategy = codec === Codec$1.H265 ? createSoftDecodeH265Strategy() : createSoftDecodeH264Strategy();
22550
22681
  mseStrategy = createHlsMseStrategy(options, useHlsJs);
22551
22682
  }
22552
- 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))) {
22553
22684
  mseStrategy = createHlsMseStrategy(options, useHlsJs);
22554
22685
  }
22555
22686
  if (!mseStrategy && !softStrategy) {
@@ -22559,7 +22690,7 @@ var __publicField = (obj, key, value) => {
22559
22690
  (mseStrategy == null ? void 0 : mseStrategy.module) && load(mseStrategy.module).catch(() => void 0),
22560
22691
  (softStrategy == null ? void 0 : softStrategy.module) && load(softStrategy.module).catch(() => void 0)
22561
22692
  ]);
22562
- (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));
22563
22694
  const combineOptions$1 = combineOptions([mseStrategy, softStrategy]);
22564
22695
  return {
22565
22696
  options: combineOptions$1,
@@ -22630,37 +22761,6 @@ var __publicField = (obj, key, value) => {
22630
22761
  });
22631
22762
  return newPlaylist;
22632
22763
  }
22633
- const getDrmStrategy = async (options, player) => {
22634
- var _a;
22635
- const drmType = getDrmType(options.drm);
22636
- if (options.url && drmType === DrmType.Fairplay) {
22637
- try {
22638
- const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
22639
- const [drmPlugin, drmConfig] = await Promise.all([
22640
- load(DynamicModule.PluginDrm).then((module2) => module2.DrmPlugin).catch(() => void 0),
22641
- getDrmConfig == null ? void 0 : getDrmConfig({
22642
- url: options.url
22643
- })
22644
- ]);
22645
- const fairplayDrmConfig = Object.assign(
22646
- {},
22647
- originFairplayConfig,
22648
- options == null ? void 0 : options.drm,
22649
- drmConfig
22650
- );
22651
- drmConfig && (player == null ? void 0 : player.updateDrmConfig(drmConfig));
22652
- return {
22653
- options: {
22654
- drm: fairplayDrmConfig
22655
- },
22656
- plugins: drmPlugin ? [drmPlugin] : []
22657
- };
22658
- } catch (error2) {
22659
- console.log(error2);
22660
- }
22661
- }
22662
- return {};
22663
- };
22664
22764
  class HlsProtocol extends BaseProtocol {
22665
22765
  static get suffix() {
22666
22766
  return ".m3u8";
@@ -22717,14 +22817,58 @@ var __publicField = (obj, key, value) => {
22717
22817
  plugins: [abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin]
22718
22818
  };
22719
22819
  }
22720
- getDrmStrategy(options, { player }) {
22721
- 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 {};
22722
22866
  }
22723
22867
  getVeStrategy() {
22724
22868
  return void 0;
22725
22869
  }
22726
22870
  }
22727
- class HlsLowLatencyProtocol extends BaseProtocol {
22871
+ class HlsLowLatencyProtocol extends HlsProtocol {
22728
22872
  static get suffix() {
22729
22873
  return ".m3u8";
22730
22874
  }
@@ -22749,12 +22893,6 @@ var __publicField = (obj, key, value) => {
22749
22893
  async getProtocolStrategy(options) {
22750
22894
  return getHlsStrategy(options);
22751
22895
  }
22752
- getAbrStrategy() {
22753
- return void 0;
22754
- }
22755
- getDrmStrategy() {
22756
- return void 0;
22757
- }
22758
22896
  getVeStrategy() {
22759
22897
  return void 0;
22760
22898
  }
@@ -22944,6 +23082,9 @@ var __publicField = (obj, key, value) => {
22944
23082
  plugins: []
22945
23083
  };
22946
23084
  }
23085
+ updateDrmConfig() {
23086
+ return void 0;
23087
+ }
22947
23088
  }
22948
23089
  class ProtocolSelector {
22949
23090
  constructor({ queue: queue2, streams, options }) {
@@ -23713,6 +23854,97 @@ var __publicField = (obj, key, value) => {
23713
23854
  })(lodash_merge, lodash_merge.exports);
23714
23855
  var lodash_mergeExports = lodash_merge.exports;
23715
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
+ }
23716
23948
  const _ProtocolManager = class {
23717
23949
  constructor(options) {
23718
23950
  __publicField(this, "_options");
@@ -23867,7 +24099,8 @@ var __publicField = (obj, key, value) => {
23867
24099
  [LiveUrlType.LLFlv]: FlvLowLatencyProtocol,
23868
24100
  [LiveUrlType.Hls]: HlsProtocol,
23869
24101
  [LiveUrlType.LLHls]: HlsLowLatencyProtocol,
23870
- [LiveUrlType.Rtm]: RtmProtocol
24102
+ [LiveUrlType.Rtm]: RtmProtocol,
24103
+ [LiveUrlType.Dash]: DashProtocol
23871
24104
  });
23872
24105
  class Fallback {
23873
24106
  constructor() {
@@ -36936,7 +37169,7 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
36936
37169
  }
36937
37170
  const { appId, deviceId, Module } = this.config;
36938
37171
  if (appId && deviceId && Module) {
36939
- await Module.bootstrap({
37172
+ Module.bootstrap({
36940
37173
  ...this.config,
36941
37174
  tracker: {
36942
37175
  Collector: this.Collector,
@@ -41483,6 +41716,12 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
41483
41716
  */
41484
41717
  constructor(options) {
41485
41718
  super(options);
41719
+ /** {en}
41720
+ * @hidden
41721
+ */
41722
+ /** {zh}
41723
+ * @hidden
41724
+ */
41486
41725
  __publicField(this, "_protocolManager");
41487
41726
  }
41488
41727
  /** {zh}
@@ -41593,14 +41832,15 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
41593
41832
  }
41594
41833
  /** {zh}
41595
41834
  * @brief 调用此方法更新 DRM 配置。
41835
+ * @param config DRM 配置对象,包含 Fairplay DRM 的相关设置。
41596
41836
  */
41597
41837
  /** {en}
41598
41838
  * @brief Use this method to update DRM configuration.
41599
- * @param config
41839
+ * @param config A configuration object containing settings for Fairplay DRM.
41600
41840
  */
41601
- updateDrmConfig(config2) {
41602
- var _a, _b, _c;
41603
- (_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);
41604
41844
  }
41605
41845
  /** {zh}
41606
41846
  * @brief 修改 ABR 配置,包含修改是否开启 ABR 功能,和修改其他清晰度。
@@ -41674,10 +41914,29 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
41674
41914
  var _a, _b, _c;
41675
41915
  return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.hls) == null ? void 0 : _c.getStats();
41676
41916
  }
41917
+ /** {en}
41918
+ * @brief This method is used to update the playlist, supporting updates to source, resolution, and related information.
41919
+ * @param playlist The playlist, consisting of multiple `Source` type elements.
41920
+ * @param target An optional target configuration, which can specify the resolution or source. Providing this information helps update the playback source for a specific resolution or stream.
41921
+ * @param needUpdateProtocol Whether the protocol needs to be updated.
41922
+ *
41923
+ * - `true`: Forces the protocol update to ensure compatibility with the playback configuration or source.
41924
+ * - `false`: Does not update the protocol and continues to use the current configuration.
41925
+ */
41926
+ /** {zh}
41927
+ * @brief 调用此方法更新播放列表,支持更新源、清晰度等相关信息。
41928
+ * @param playlist 播放列表,包含多个 `Source` 类型的元素。
41929
+ * @param target 可选的目标配置项,可以指定清晰度或源。提供这些信息可以帮助更新特定清晰度或线路的播放源。
41930
+ * @param needUpdateProtocol 是否需要更新协议。
41931
+ * - `true`:强制更新协议,以确保播放配置或源的兼容性。
41932
+ * - `false`:不更新协议,继续使用当前配置。
41933
+ */
41677
41934
  async updatePlaylist(playlist, target, needUpdateProtocol = true) {
41678
41935
  var _a;
41679
41936
  if (needUpdateProtocol) {
41680
- await ((_a = this._protocolManager) == null ? void 0 : _a.update({ playlist }));
41937
+ await ((_a = this._protocolManager) == null ? void 0 : _a.update({
41938
+ playlist
41939
+ }));
41681
41940
  }
41682
41941
  return super.updatePlaylist(playlist, target);
41683
41942
  }
@@ -41717,7 +41976,9 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
41717
41976
  teaTracker,
41718
41977
  preProcessUrl: (url2) => {
41719
41978
  if (isType(".ts", url2)) {
41720
- return { url: url2 };
41979
+ return {
41980
+ url: url2
41981
+ };
41721
41982
  }
41722
41983
  return {
41723
41984
  url: generateUrlWithSessionId(url2)
@@ -41725,7 +41986,9 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
41725
41986
  },
41726
41987
  async preparePlugins(url2) {
41727
41988
  if (!protocolManager.enableSelector) {
41728
- await protocolManager.update({ url: url2 });
41989
+ await protocolManager.update({
41990
+ url: url2
41991
+ });
41729
41992
  }
41730
41993
  return protocolManager.getStrategy(
41731
41994
  player,