ashqal / MD360Player4Android

It is a lite library to render 360 degree panorama video for Android. VR Player.
Apache License 2.0
1.08k stars 357 forks source link

Playing Local Files #46

Closed fabiotnt closed 8 years ago

fabiotnt commented 8 years ago

I've tried to play some local videos, but I can't. The error that returns to me is Protocol not Found.

I've tried a lot of combinations to use android.resource:// protocol, but no luck. My final version is this:

private Uri getRawResourceUri(@RawRes int resId){ Resources resources = getResources(); Uri uri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + resources.getResourcePackageName(resId) + '/' + resources.getResourceTypeName(resId) + '/' + resources.getResourceEntryName(resId) ); return uri; }

When I try a remote video, the app runs like a charm.

My video file has been placed on resources/raw folder and called default_movie.mp4.

Thanks a lot.

ashqal commented 8 years ago

17 Try this please.

liuxue0905 commented 8 years ago

@fabiotnt Your video is a DOME video? It's different form a sphere video.

JavierCruz commented 8 years ago

I have the same problem (trying to load an internal file). I went to the link which ashqal said, but responses are in chinese or japanese and I can't understand it. I tried to use yangkai3 solution, but I don't know if I'm doing it wrong but it doesn't works. Could someone explain me a little more how to make it work?

ashqal commented 8 years ago

1.ensure the sdcard read permission 2.use target sdk below 22 or deal with the permission request in sdk 23. 3.Uri.parse("file:///mnt/sdcard/demo.mp4")

JavierCruz commented 8 years ago

I'm trying to load the file from res/raw not SDcard, points 1 and 2 are ok. But I'm trying to load the file by: Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.video) and it doesn't works. Any sugestion?

ashqal commented 8 years ago

https://github.com/Bilibili/ijkplayer/issues/1013 May help.

ashqal commented 8 years ago

@electmk It just a demo class, you can change any function... For example, if the URI is start with assert, then dispatch to another function to deal with the input URI.