Commit c56fd2d9 authored by Deon Nicholas's avatar Deon Nicholas Committed by Matt Apperson
Browse files

[Android] App crash when unmounting video (#533)

* Upgrade to ScalableVideoView version 1.0.4

* Fix bug in cleanupMediaPlayerResources

* Fix VideoView on Android
parent 9ce1f4b5
Loading
Loading
Loading
Loading
+1 −1
Changes for android/build.gradle: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -17,5 +17,5 @@ android {

dependencies {
    provided 'com.facebook.react:react-native:+'
    compile 'com.yqritc:android-scalablevideoview:1.0.1'
    compile 'com.yqritc:android-scalablevideoview:1.0.4'
}
+2 −4
Changes for android/src/main/java/com/brentvatne/react/ReactVideoView.java: 2 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -194,8 +194,7 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP
        }
        if ( mMediaPlayer != null ) {
            mMediaPlayerValid = false;
            mMediaPlayer.stop();
            mMediaPlayer.release();
            release();
        }
    }

@@ -296,9 +295,8 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP
        event.putMap(ReactVideoViewManager.PROP_SRC, src);
        mEventEmitter.receiveEvent(getId(), Events.EVENT_LOAD_START.toString(), event);

        // not async to prevent random crashes on Android playback from local resource due to race conditions
        try {
          prepare(this);
          prepareAsync(this);
        } catch (Exception e) {
          e.printStackTrace();
        }