diff --git a/android/src/main/java/com/brentvatne/react/ReactVideoView.java b/android/src/main/java/com/brentvatne/react/ReactVideoView.java index 0f9a923d..a31f29d3 100644 --- a/android/src/main/java/com/brentvatne/react/ReactVideoView.java +++ b/android/src/main/java/com/brentvatne/react/ReactVideoView.java @@ -58,6 +58,7 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP private String mSrcUriString = null; private String mSrcType = "mp4"; private boolean mSrcIsNetwork = false; + private boolean mSrcIsAsset = false; private ScalableType mResizeMode = ScalableType.LEFT_TOP; private boolean mRepeat = false; private boolean mPaused = false; @@ -107,10 +108,11 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP } } - public void setSrc(final String uriString, final String type, final boolean isNetwork) { + public void setSrc(final String uriString, final String type, final boolean isNetwork, final boolean isAsset) { mSrcUriString = uriString; mSrcType = type; mSrcIsNetwork = isNetwork; + mSrcIsAsset = isAsset; mMediaPlayerValid = false; mVideoDuration = 0; @@ -120,7 +122,7 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP mMediaPlayer.reset(); try { - if (isNetwork) { + if (isNetwork || isAsset) { setDataSource(uriString); } else { setRawData(mThemedReactContext.getResources().getIdentifier( @@ -281,6 +283,6 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - setSrc(mSrcUriString, mSrcType, mSrcIsNetwork); + setSrc(mSrcUriString, mSrcType, mSrcIsNetwork, mSrcIsAsset); } } diff --git a/android/src/main/java/com/brentvatne/react/ReactVideoViewManager.java b/android/src/main/java/com/brentvatne/react/ReactVideoViewManager.java index 3c21d60d..6439f757 100644 --- a/android/src/main/java/com/brentvatne/react/ReactVideoViewManager.java +++ b/android/src/main/java/com/brentvatne/react/ReactVideoViewManager.java @@ -22,6 +22,7 @@ public class ReactVideoViewManager extends SimpleViewManager { public static final String PROP_SRC_URI = "uri"; public static final String PROP_SRC_TYPE = "type"; public static final String PROP_SRC_IS_NETWORK = "isNetwork"; + public static final String PROP_SRC_IS_ASSET = "isAsset"; public static final String PROP_RESIZE_MODE = "resizeMode"; public static final String PROP_REPEAT = "repeat"; public static final String PROP_PAUSED = "paused"; @@ -66,7 +67,8 @@ public class ReactVideoViewManager extends SimpleViewManager { videoView.setSrc( src.getString(PROP_SRC_URI), src.getString(PROP_SRC_TYPE), - src.getBoolean(PROP_SRC_IS_NETWORK) + src.getBoolean(PROP_SRC_IS_NETWORK), + src.getBoolean(PROP_SRC_IS_ASSET) ); }