question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Read the video from android asset folder

See original GitHub issue

I 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

The same issue: #2096, #1826

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
evoactivitycommented, Sep 28, 2022

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

1reaction
rohitsingh2410commented, Aug 31, 2022

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%", }} />

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found