Playing mp4 video - for android from local raw/assets folder
See original GitHub issueHello, I am trying to play an mp4 file using exoplayer. I have the mp4 file on my android “raw” folder and it can be moved to “assets” folder if needed.
I have tried modifying the demo app - “SampleChooserAcitivity” as below:
sampleAdapter.add((Object) new Sample("My Video", path,
DemoUtil.TYPE_MP4));
I have tried the variable “path” with the below options and none of them work for me.
Option 1 (from assets folder) path = “file:///video.mp4”;
Option 2 (from assets folder) path = “file:///android_asset/video.mp4”;
Option 3 (from raw folder) path = “android.resource://” + getPackageName() + “/” + R.raw.video;
Please suggest. Thanks!
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Android How to play media files(.mp4) from assets folder
openFd("hello.mp4"); MediaPlayer player = new MediaPlayer(); if(player ... -media-player-error-1-4-while-playing-an-audio-from-assets-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 Play Video from Assets/URL in Flutter - Flutter Campus
To play video from the assets folder, create a folder at your project root, and place your video in that folder. For example,...
Read more >Question - Playing video from Streaming Assets folder is choppy
I am trying to play a video from the streaming assets folder on android. I can get it to play but it is...
Read more >How to use streaming assets in Unity - LogRocket Blog
Then, it will take myVideoPlayer (that already has the reference of our scene video player) and it will write its url property with...
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
Oops, I meant “assets” folder. I did some work on playing the video from “raw” initially, but no luck. I had to move to the “assets” folder to use Exo.
http://google.github.io/ExoPlayer/doc/reference/index.html?com/google/android/exoplayer2/upstream/DefaultDataSource.html
Note - In general just go to http://google.github.io/ExoPlayer/doc/reference/ if you can’t find documentation for a class. It’s all there and pretty easy to navigate.