[expo-av] NullPointerException at VideoView.java

🐛 Bug Report

Summary of Issue

I have an app that uses expo-av to show videos from users gallery. I am getting crash reports from play console.

Environment – output of expo diagnostics & the platform(s) you’re targeting

I am using expo-av on bare react native project.

react-native : 0.62.2
expo-av: 8.2.1
expo-image-picker: 8.3.0
react-native-unimodules: 0.10.1

buildToolsVersion = “29.0.0”
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29

Reproducible Demo

I don’t have a reproducible demo because i don’t know what causes this issue.

Steps to Reproduce

I don’t have steps to reproduce the error because i don’t know what causes this issue.

Expected Behavior vs Actual Behavior

Expected behavior is that the application does not crash.
Actual behavior is app crashing.

Stack Trace

  at expo.modules.av.video.VideoView$5.a (VideoView.java:111)
  at expo.modules.av.player.SimpleExoPlayerData.a (SimpleExoPlayerData.java:14)
  at com.google.android.exoplayer2.ExoPlayerImpl$PlaybackInfoUpdate.notifyListeners (ExoPlayerImpl.java:169)
  at com.google.android.exoplayer2.ExoPlayerImpl.a (ExoPlayerImpl.java:63)
  at com.google.android.exoplayer2.ExoPlayerImpl.a (ExoPlayerImpl.java:79)
  at com.google.android.exoplayer2.ExoPlayerImpl.a (ExoPlayerImpl.java:93)
  at com.google.android.exoplayer2.ExoPlayerImpl$1.handleMessage (ExoPlayerImpl.java:2)
  at android.os.Handler.dispatchMessage (Handler.java:112)
  at android.os.Looper.loop (Looper.java:216)
  at android.app.ActivityThread.main (ActivityThread.java:7625)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:524)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:987)

My Code

    source={{ uri: this.state.videoPath }}
    ref={ (ref) => this.player = ref }
    style={{ width: Dimensions.get("window").width, height: "100%%" }}

VideoView.java:111 points to this which is a function that throws an error and this function called in this and this function.

The first one is setSource and other one is onLoadError so my guess is when loading the video something happens. Maybe unsupported video format? How can i solve or debug this problem? Thank you so much.

1 possible answer(s) on “[expo-av] NullPointerException at VideoView.java

  1. I’ve actually been able to reproduce the problem using the information provided by @ahmetbicer
    There is an issue with how the error-handler cleans up the media-player controls when an error occurs when loading the video source.
    I’m working on a solution.