I'm trying to get a load a mp4 file from the android file browser. However the path from the following code does not work. It throws an exception
Uri currFileURI = data.getData(); String path=currFileURI.getPath(); MediaExtractor extractor = new MediaExtractor(); try { extractor.setDataSource(path); } catch( IOException e) { e.printStackTrace(); return; } Data I have:
data = {Intent@9869} "Intent { dat=content://com.android.providers.downloads.documents/document/44 flg=0x1 }" currFileURI = {Uri$HierarchicalUri@9870} "content://com.android.providers.downloads.documents/document/44" path = "/document/44"
I see this code in stackoverflow: How to get the Full file path from URI
This looks like an overkill
I can see the method takes in a file path. https://developer.android.com/reference/android/media/MediaExtractor#setDataSource(java.lang.String)
So it looks the path from the android file browser is different from what the method wants. I also see that the path from the file browser is different than the file name. Anybody have an insight into what the path should look like?