android - How do I get the actual path of the video sent to my app from Gallery via the ContentProvider URI? -


i have app in i'd view video file chose share gallery edited. know have use intent-filter tag in manifest of activity.

so here was, selecting video gallery app 'shared' app. when activity opens, used uri videouri = getintent().getparcelableextra(intent.extra_stream); retrieve uri of video. uri looks this:

content://com.google.android.apps.photos.contentprovider/-1/2/file%3a%2f%2f%2fdata%2fdata%2fcom.google.android.apps.photos%2fcache%2fshare-cache%2fmedia.tmp%3ffilename%3dimage.jpg/original/none/1804018524

i can play fine in mediaplayer, problem comes when have use library requires file [namely, mp4parser], , means file path - uri doesn't work.

i've parsed file%3a%2f%2f%2fdata%2fdata%2fcom.google.android.apps.photos%2fcache%2fshare-cache%2fmedia.tmp%3ffilename%3dimage.jpg part, , gives me:

file:///data/data/com.google.android.apps.photos/cache/share-cache/media.tmp?filename=image.jpg

the problem opening results in enoent. new file("/data/data/com.google.android.apps.photos/cache/share-cache/media.tmp").exists() returns false.

i've queried uri in cursor via getcontentresolver().query(uri, null, null, null, null) , logged values inside. got was:

_id:0 _display_name:image.jpg _size:2183131 mime_type:video/mpeg _data:null orientation:0 datetaken:0 latitude:null longitude:null special_type_id:null

my question: there way inquire actual path [either in file:// form or in content://media/external/videos/...] of video shared gallery app if uri sends out?

turns out needed open inputstream said uri via contentresolver, write fileoutputstream directed towards temporary file (right have temporary file inside app's filesdir), use data source instead.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -