Read the video from android asset folder
See original GitHub issueI must to read the video from android asset folder, so using require or putting the video in android/raw doesn’t suit my needs.
I know this issue has been reported, but it doesn’t seem to actually fix it. Hope someone can help me, thanks.
Below are the paths I’ve tried, but unfortunately none of them work.
source={{ uri: 'file:///android_asset/test.mp4' }}
source={{ uri: 'asset:/test.mp4' }}
Related References: Using file path in react-native-video Path of Android asset folder The same issue but he fix it by adjusting source code Read the video from android raw folder but not my case
Issue Analytics
- State:
 - Created a year ago
 - Comments:6 (1 by maintainers)
 
Top Results From Across the Web
Android: how to play video from assets? - Stack Overflow
Instead of accessing from assests,You must copy the video into your project's res/raw folder. Create raw folder under res folder.
Read more >How to play videos in Android from assets folder or raw folder?
How to play videos in Android from assets folder or raw folder? ; Step 1 − Create a new project in Android Studio,...
Read more >How to create Assets Folder in Android Studio - YouTube
Your browser can't play this video. Learn more. Switch camera.
Read more >Assets Folder in Android Studio - GeeksforGeeks
Read ; Discuss; Practice; Video; Courses ... Step 1: To create an asset folder in Android studio open your project in Android mode...
Read more >Using Android Assets - Xamarin | Microsoft Learn
Assets provide a way to include arbitrary files like text, xml, fonts, music, and video in your application. Learn about using Android ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This will need a new loader adding to support loading files from assets.
An example of this being done in exoplayer can be seen here
We’d essentially want to add a detection for an asset:// type and add a new loader here https://github.com/react-native-video/react-native-video/blob/66b2ba3fcfd4efb7863530da76950ba397ebde85/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java#L722
try like
require('../../assets/video.mp4')<Video ref={(ref) => { this.player = ref }} source={videoURL} style={{ position: 'relative', top: 0, left: 0, bottom: 0, right: 0, width:"100%",height:"100%", }} />