You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ReactNative安卓端react-native-video拖动/加载时抛出ExoPlaybackException异常

Bug

我使用react-native-video组件为应用添加视频播放器能力,该组件在Android端会持续抛出如下错误:错误触发时机为视频播放过程中拖动进度条时,部分场景下视频加载完成时也会触发。

{"error": {"errorException": "com.google.android.exoplayer2.ExoPlaybackException: java.lang.IllegalStateException", "errorString": "ExoPlaybackException type : 1"}}

运行平台

Android ReactNative Exoplayer

环境信息

react-native info 输出如下:

System:
    OS: macOS 11.4
    CPU: (8) x64 Apple M1
    Memory: 27.89 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.0 - /usr/local/bin/node
    Yarn: Not Found
    npm: 7.19.1 - /usr/local/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
    Android SDK:
      API Levels: 23, 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3
      System Images: android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.2 AI-202.7660.26.42.7351085
    Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.3 => 0.63.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

依赖库版本:

react-native-video: 5.1.1

复现步骤

完整复现步骤如下:

复现方式1

  • 竖屏模式下启动视频播放
  • 切换为横屏模式后,拖动进度条到任意位置
  • 点击播放视频
  • 视频缓冲一段时间后抛出错误,无法继续播放

复现方式2

  • 将Video组件嵌套在小尺寸View中,示例代码如下:
<View style={{width: 200, height: 200}}>
...<Video/>
</View>
  • 视频加载完成后立即抛出错误

注意 上述两个场景中,我均设置了controls={false},自行实现了进度拖动、播放、恢复等逻辑。

预期行为

  • 拖动进度条后恢复播放时不会抛出错误,视频可正常播放

更多信息与实现细节可查看:GitHub Issue、实现代码片段


内容的提问来源于stack exchange,提问作者mzaink

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.08 23:42:03