Playing mp4 video - for android from local raw/assets folder

See original GitHub issue

Hello, 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:closed
  • Created 8 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sasindroidcommented, Jun 18, 2015

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.

0reactions
ojw28commented, Nov 1, 2016

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.

Read more comments on GitHub >

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

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