@volcengine/veplayer 2.10.1 → 2.10.2-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volcengine/veplayer",
3
- "version": "2.10.1",
3
+ "version": "2.10.2-rc.1",
4
4
  "main": "./umd/veplayer.production.js",
5
5
  "module": "./esm/veplayer.production.js",
6
6
  "browser": "./umd/veplayer.production.js",
package/umd/index.d.ts CHANGED
@@ -2092,7 +2092,7 @@ declare class VePlayerBase {
2092
2092
  /** {en}
2093
2093
  * @brief Starts playback.
2094
2094
  */
2095
- play(): any;
2095
+ play(): Promise<any>;
2096
2096
  /** {zh}
2097
2097
  * @brief 调用此方法暂停播放。
2098
2098
  */
@@ -26575,10 +26575,10 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
26575
26575
  device_id: deviceId,
26576
26576
  error_report_stop: true,
26577
26577
  ext: {
26578
- veplayer_version: "2.3.0",
26578
+ veplayer_version: "2.3.1-rc.1",
26579
26579
  flv_version: "3.0.23-rc.6",
26580
26580
  hls_version: "3.0.21-rc.21",
26581
- rts_version: "0.2.1-alpha.51"
26581
+ rts_version: "0.2.1-alpha.53"
26582
26582
  }
26583
26583
  });
26584
26584
  }
@@ -28172,7 +28172,10 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
28172
28172
  }
28173
28173
  async canPlay() {
28174
28174
  return {
28175
- canPlay: isFLVSupported()
28175
+ canPlay: isFLVSupported(),
28176
+ extraInfo: {
28177
+ isFLVSupported: isFLVSupported()
28178
+ }
28176
28179
  };
28177
28180
  }
28178
28181
  shouldFallbackWhenStall() {
@@ -28656,7 +28659,11 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
28656
28659
  isRTMSupportCodec()
28657
28660
  ]);
28658
28661
  return {
28659
- canPlay: isSupported && isSupportCodec
28662
+ canPlay: isSupported && isSupportCodec,
28663
+ extraInfo: {
28664
+ isRTMSupported: isSupported,
28665
+ isRTMSupportCodec: isSupportCodec
28666
+ }
28660
28667
  };
28661
28668
  }
28662
28669
  shouldFallbackWhenStall() {
@@ -28712,16 +28719,20 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
28712
28719
  this.current = this._getStartProtocol();
28713
28720
  }
28714
28721
  // 获取最终返回的播放类型和参数。
28715
- async getProtocol() {
28722
+ async getProtocol(protocolCanPlayResults = {}) {
28716
28723
  if (!this.current) {
28717
28724
  return;
28718
28725
  }
28719
- const { canPlay } = await this.current.canPlay() ?? {};
28726
+ const { canPlay, extraInfo } = await this.current.canPlay() ?? {};
28727
+ protocolCanPlayResults[this.current.protocolType] = {
28728
+ canPlay,
28729
+ ...extraInfo
28730
+ };
28720
28731
  if (canPlay) {
28721
28732
  return this.current;
28722
28733
  }
28723
28734
  this.next();
28724
- return this.getProtocol();
28735
+ return this.getProtocol(protocolCanPlayResults);
28725
28736
  }
28726
28737
  // 降级时,将指针指到上次结束的位置
28727
28738
  next() {
@@ -34591,6 +34602,8 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
34591
34602
  __publicField(this, "_selector");
34592
34603
  __publicField(this, "_protocol");
34593
34604
  __publicField(this, "_playlistMap", {});
34605
+ // 存储每个协议的 canPlay 检查结果
34606
+ __publicField(this, "_protocolCanPlayResults", {});
34594
34607
  this._options = options;
34595
34608
  this._init({
34596
34609
  url: options.url,
@@ -34603,6 +34616,10 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
34603
34616
  get protocol() {
34604
34617
  return this._protocol;
34605
34618
  }
34619
+ // 获取协议选择过程中每个协议的 canPlay 检查结果
34620
+ get protocolCanPlayResults() {
34621
+ return this._protocolCanPlayResults;
34622
+ }
34606
34623
  get queue() {
34607
34624
  var _a;
34608
34625
  return (_a = this._selector) == null ? void 0 : _a._queue;
@@ -34650,8 +34667,11 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
34650
34667
  return { protocolMap, playlistMap };
34651
34668
  }
34652
34669
  async getProtocol() {
34670
+ this._protocolCanPlayResults = {};
34653
34671
  if (this._selector) {
34654
- this._protocol = await this._selector.getProtocol();
34672
+ this._protocol = await this._selector.getProtocol(
34673
+ this._protocolCanPlayResults
34674
+ );
34655
34675
  }
34656
34676
  return this._protocol;
34657
34677
  }
@@ -34756,7 +34776,7 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
34756
34776
  __publicField(this, "player");
34757
34777
  __publicField(this, "protocolManager");
34758
34778
  __publicField(this, "beforeFallbackError", async (error2) => {
34759
- var _a, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2;
34779
+ var _a, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2, _o;
34760
34780
  if (!((_b = (_a = this.protocolManager) == null ? void 0 : _a.protocol) == null ? void 0 : _b.shouldFallbackWhenError({ error: error2 })) || !((_d = (_c = this.protocolManager) == null ? void 0 : _c.protocol) == null ? void 0 : _d.nextProtocol)) {
34761
34781
  return { canEmitError: true };
34762
34782
  }
@@ -34777,13 +34797,22 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
34777
34797
  }
34778
34798
  });
34779
34799
  this.fallback();
34780
- (_n2 = teaTracker.liveLogger) == null ? void 0 : _n2.sendLog({
34800
+ let canplayStr = "";
34801
+ try {
34802
+ canplayStr = JSON.stringify((_l = this.protocolManager) == null ? void 0 : _l.protocolCanPlayResults);
34803
+ canplayStr = `json:${canplayStr}`;
34804
+ } catch (e2) {
34805
+ console.warn("Failed to stringify protocolCanPlayResults:", e2);
34806
+ canplayStr = "json:{}";
34807
+ }
34808
+ (_o = teaTracker.liveLogger) == null ? void 0 : _o.sendLog({
34781
34809
  event_key: "fallback",
34782
34810
  playlist: this.protocolManager.playlist,
34783
34811
  code: error2.errorCode,
34784
34812
  message: error2.message,
34785
34813
  // 降级的协议
34786
- protocol: (_m = (_l = this.protocolManager) == null ? void 0 : _l.protocol) == null ? void 0 : _m.protocolType
34814
+ protocol: (_n2 = (_m = this.protocolManager) == null ? void 0 : _m.protocol) == null ? void 0 : _n2.protocolType,
34815
+ canplay: canplayStr
34787
34816
  });
34788
34817
  return { canEmitError: false };
34789
34818
  });
@@ -49820,9 +49849,7 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
49820
49849
  logger: options.logger,
49821
49850
  appId: ((_c = options.logger) == null ? void 0 : _c.appId) || 654925,
49822
49851
  syncWaitSettings: false,
49823
- strategies: {
49824
- rtmAdaptiveBuffer: true
49825
- }
49852
+ strategies: {}
49826
49853
  });
49827
49854
  if (!teaTracker.tea) {
49828
49855
  teaTracker.init(options.logger);
@@ -49870,6 +49897,14 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
49870
49897
  },
49871
49898
  VePlayerLive
49872
49899
  );
49900
+ let canplayStr = "";
49901
+ try {
49902
+ canplayStr = JSON.stringify(protocolManager.protocolCanPlayResults);
49903
+ canplayStr = `json:${canplayStr}`;
49904
+ } catch (e2) {
49905
+ console.warn("Failed to stringify protocolCanPlayResults:", e2);
49906
+ canplayStr = "json:{}";
49907
+ }
49873
49908
  (_h = teaTracker.liveLogger) == null ? void 0 : _h.sendLog({
49874
49909
  event_key: "initial_info",
49875
49910
  // 是否开启多 Source
@@ -49880,10 +49915,7 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
49880
49915
  // 初始化 protocol
49881
49916
  protocol: (_g = protocolManager.protocol) == null ? void 0 : _g.protocolType
49882
49917
  },
49883
- // 协议支持相关
49884
- isRTMSupportCodec: await isRTMSupportCodec(),
49885
- isRTMSupported: await isRTMSupported(),
49886
- isFLVSupported: isFLVSupported()
49918
+ canplay: canplayStr
49887
49919
  });
49888
49920
  player._protocolManager = protocolManager;
49889
49921
  fallback.initErrorFallback(player, protocolManager);
@@ -49919,7 +49951,7 @@ Radeong 0.4 on AMD TAHITI (DRM 2.43.0, LLVM 3.9.0)|-1
49919
49951
  }
49920
49952
  await ((_a = liveVeStrategy.veStrategyManager) == null ? void 0 : _a.init({
49921
49953
  ...options,
49922
- playerVersion: "2.3.0",
49954
+ playerVersion: "2.3.1-rc.1",
49923
49955
  type: "LIVE"
49924
49956
  }));
49925
49957
  return liveVeStrategy.veStrategyManager;