setLoadFailureDetection method

Future<void> setLoadFailureDetection({
  1. int firstFrameTimeoutSec = 15,
  2. int stallTimeoutSec = 15,
})

配置加载失败检测。loading 超时(起播拿不到首帧 / 中途卡顿迟迟不恢复)时, 原生侧停止 loading 并通过 error 事件上报,detail 含 reason (见 PlayerLoadFailureReason),由宿主展示「加载失败/点击重试」。 不做断网检测:超时是结果导向,命中缓存能播就不会触发,与缓存等业务无关; 断网判断交给宿主(如 connectivity_plus),收到 load_timeout 后宿主可结合 网络状态决定文案(无网 vs 播放地址失效)。默认 15s/15s。

  • firstFrameTimeoutSec 起播超时秒数,<=0 禁用(默认 15)
  • stallTimeoutSec 中途卡顿超时秒数,<=0 禁用(默认 15)

Implementation

Future<void> setLoadFailureDetection({
  int firstFrameTimeoutSec = 15,
  int stallTimeoutSec = 15,
}) =>
    _invoke('setLoadFailureDetection', {
      'firstFrameTimeoutSec': firstFrameTimeoutSec,
      'stallTimeoutSec': stallTimeoutSec,
    });