@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/esm/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
  */
@@ -26571,10 +26571,10 @@ let Logger$1 = class Logger2 extends Plugin$2 {
26571
26571
  device_id: deviceId,
26572
26572
  error_report_stop: true,
26573
26573
  ext: {
26574
- veplayer_version: "2.3.0",
26574
+ veplayer_version: "2.3.1-rc.1",
26575
26575
  flv_version: "3.0.23-rc.6",
26576
26576
  hls_version: "3.0.21-rc.21",
26577
- rts_version: "0.2.1-alpha.51"
26577
+ rts_version: "0.2.1-alpha.53"
26578
26578
  }
26579
26579
  });
26580
26580
  }
@@ -28174,7 +28174,10 @@ class FlvProtocol extends BaseProtocol {
28174
28174
  }
28175
28175
  async canPlay() {
28176
28176
  return {
28177
- canPlay: isFLVSupported()
28177
+ canPlay: isFLVSupported(),
28178
+ extraInfo: {
28179
+ isFLVSupported: isFLVSupported()
28180
+ }
28178
28181
  };
28179
28182
  }
28180
28183
  shouldFallbackWhenStall() {
@@ -28658,7 +28661,11 @@ class RtmProtocol extends BaseProtocol {
28658
28661
  isRTMSupportCodec()
28659
28662
  ]);
28660
28663
  return {
28661
- canPlay: isSupported && isSupportCodec
28664
+ canPlay: isSupported && isSupportCodec,
28665
+ extraInfo: {
28666
+ isRTMSupported: isSupported,
28667
+ isRTMSupportCodec: isSupportCodec
28668
+ }
28662
28669
  };
28663
28670
  }
28664
28671
  shouldFallbackWhenStall() {
@@ -28714,16 +28721,20 @@ class ProtocolSelector {
28714
28721
  this.current = this._getStartProtocol();
28715
28722
  }
28716
28723
  // 获取最终返回的播放类型和参数。
28717
- async getProtocol() {
28724
+ async getProtocol(protocolCanPlayResults = {}) {
28718
28725
  if (!this.current) {
28719
28726
  return;
28720
28727
  }
28721
- const { canPlay } = await this.current.canPlay() ?? {};
28728
+ const { canPlay, extraInfo } = await this.current.canPlay() ?? {};
28729
+ protocolCanPlayResults[this.current.protocolType] = {
28730
+ canPlay,
28731
+ ...extraInfo
28732
+ };
28722
28733
  if (canPlay) {
28723
28734
  return this.current;
28724
28735
  }
28725
28736
  this.next();
28726
- return this.getProtocol();
28737
+ return this.getProtocol(protocolCanPlayResults);
28727
28738
  }
28728
28739
  // 降级时,将指针指到上次结束的位置
28729
28740
  next() {
@@ -34593,6 +34604,8 @@ const _ProtocolManager = class {
34593
34604
  __publicField(this, "_selector");
34594
34605
  __publicField(this, "_protocol");
34595
34606
  __publicField(this, "_playlistMap", {});
34607
+ // 存储每个协议的 canPlay 检查结果
34608
+ __publicField(this, "_protocolCanPlayResults", {});
34596
34609
  this._options = options;
34597
34610
  this._init({
34598
34611
  url: options.url,
@@ -34605,6 +34618,10 @@ const _ProtocolManager = class {
34605
34618
  get protocol() {
34606
34619
  return this._protocol;
34607
34620
  }
34621
+ // 获取协议选择过程中每个协议的 canPlay 检查结果
34622
+ get protocolCanPlayResults() {
34623
+ return this._protocolCanPlayResults;
34624
+ }
34608
34625
  get queue() {
34609
34626
  var _a;
34610
34627
  return (_a = this._selector) == null ? void 0 : _a._queue;
@@ -34652,8 +34669,11 @@ const _ProtocolManager = class {
34652
34669
  return { protocolMap, playlistMap };
34653
34670
  }
34654
34671
  async getProtocol() {
34672
+ this._protocolCanPlayResults = {};
34655
34673
  if (this._selector) {
34656
- this._protocol = await this._selector.getProtocol();
34674
+ this._protocol = await this._selector.getProtocol(
34675
+ this._protocolCanPlayResults
34676
+ );
34657
34677
  }
34658
34678
  return this._protocol;
34659
34679
  }
@@ -34758,7 +34778,7 @@ class Fallback {
34758
34778
  __publicField(this, "player");
34759
34779
  __publicField(this, "protocolManager");
34760
34780
  __publicField(this, "beforeFallbackError", async (error2) => {
34761
- var _a, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2;
34781
+ var _a, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2, _o;
34762
34782
  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)) {
34763
34783
  return { canEmitError: true };
34764
34784
  }
@@ -34779,13 +34799,22 @@ class Fallback {
34779
34799
  }
34780
34800
  });
34781
34801
  this.fallback();
34782
- (_n2 = teaTracker.liveLogger) == null ? void 0 : _n2.sendLog({
34802
+ let canplayStr = "";
34803
+ try {
34804
+ canplayStr = JSON.stringify((_l = this.protocolManager) == null ? void 0 : _l.protocolCanPlayResults);
34805
+ canplayStr = `json:${canplayStr}`;
34806
+ } catch (e2) {
34807
+ console.warn("Failed to stringify protocolCanPlayResults:", e2);
34808
+ canplayStr = "json:{}";
34809
+ }
34810
+ (_o = teaTracker.liveLogger) == null ? void 0 : _o.sendLog({
34783
34811
  event_key: "fallback",
34784
34812
  playlist: this.protocolManager.playlist,
34785
34813
  code: error2.errorCode,
34786
34814
  message: error2.message,
34787
34815
  // 降级的协议
34788
- protocol: (_m = (_l = this.protocolManager) == null ? void 0 : _l.protocol) == null ? void 0 : _m.protocolType
34816
+ protocol: (_n2 = (_m = this.protocolManager) == null ? void 0 : _m.protocol) == null ? void 0 : _n2.protocolType,
34817
+ canplay: canplayStr
34789
34818
  });
34790
34819
  return { canEmitError: false };
34791
34820
  });
@@ -49816,9 +49845,7 @@ async function createLivePlayer(options) {
49816
49845
  logger: options.logger,
49817
49846
  appId: ((_c = options.logger) == null ? void 0 : _c.appId) || 654925,
49818
49847
  syncWaitSettings: false,
49819
- strategies: {
49820
- rtmAdaptiveBuffer: true
49821
- }
49848
+ strategies: {}
49822
49849
  });
49823
49850
  if (!teaTracker.tea) {
49824
49851
  teaTracker.init(options.logger);
@@ -49866,6 +49893,14 @@ async function createLivePlayer(options) {
49866
49893
  },
49867
49894
  VePlayerLive
49868
49895
  );
49896
+ let canplayStr = "";
49897
+ try {
49898
+ canplayStr = JSON.stringify(protocolManager.protocolCanPlayResults);
49899
+ canplayStr = `json:${canplayStr}`;
49900
+ } catch (e2) {
49901
+ console.warn("Failed to stringify protocolCanPlayResults:", e2);
49902
+ canplayStr = "json:{}";
49903
+ }
49869
49904
  (_h = teaTracker.liveLogger) == null ? void 0 : _h.sendLog({
49870
49905
  event_key: "initial_info",
49871
49906
  // 是否开启多 Source
@@ -49876,10 +49911,7 @@ async function createLivePlayer(options) {
49876
49911
  // 初始化 protocol
49877
49912
  protocol: (_g = protocolManager.protocol) == null ? void 0 : _g.protocolType
49878
49913
  },
49879
- // 协议支持相关
49880
- isRTMSupportCodec: await isRTMSupportCodec(),
49881
- isRTMSupported: await isRTMSupported(),
49882
- isFLVSupported: isFLVSupported()
49914
+ canplay: canplayStr
49883
49915
  });
49884
49916
  player._protocolManager = protocolManager;
49885
49917
  fallback.initErrorFallback(player, protocolManager);
@@ -49915,7 +49947,7 @@ async function prepare(options) {
49915
49947
  }
49916
49948
  await ((_a = liveVeStrategy.veStrategyManager) == null ? void 0 : _a.init({
49917
49949
  ...options,
49918
- playerVersion: "2.3.0",
49950
+ playerVersion: "2.3.1-rc.1",
49919
49951
  type: "LIVE"
49920
49952
  }));
49921
49953
  return liveVeStrategy.veStrategyManager;