1

Hi all and thanks in advance.

After all day trying and searching why videos load in a html with a webview or directly the .mp4 with a VideoView, i have discovered whats the problem.

Apparently files in internal storage just have app permisions, but MediaPlayer or other externals objects does not have permissions. Is this rigth?. If i put that same video in res/raw it can be played with no problem.

Ok. I need my files in internal storage, and i get the files from a internet .zip wich i unzip under a location WITH path separators, because is a whole structure.

So i have been looking and trying but i cannot find how to do it, because if i try to give permissions to a file, if my device, and it is not, rooted, i just found that just can do a context.openFileOutput(filePath, Context.MODE_WORLD_READABLE) but this give me a exception because there is path separators, what i cannot understand whats the problem with that....the thing is that i cannot try that when i unzip the file neither in other future moment cause the path separators.....how can i set global permissions to an internal file with path separators?

Or what can i do? the thing is i need to make a webview load a html with all pictures and videos in same folder with path separators.....it is impossible in internal storage?

Really thanks for all, any help will be appreciated..

Rako
  • 249
  • 1
  • 4
  • 15
  • 1
    You'll need to implement a `ContentProvider` to allow other apps to access your app's private storage. – 323go Oct 16 '13 at 17:07
  • Thanks 323go.....i never used them, i will search info and i will try because i cannot see other solution for this issue...... – Rako Oct 16 '13 at 17:18
  • This ought to get you started -- it's not very difficult. https://github.com/commonsguy/cw-advandroid/tree/master/ContentProvider – 323go Oct 16 '13 at 18:09

2 Answers2

0

I was running into the exact same issue. It was particularly troublesome because I had no similar issues with viewing images in an ImageView from internal storage.

Two ways to go about it, depending on your app's requirements:

  1. Content Providers

  2. Temporary File in External Storage

    This worked for me the best and easiest. I simply copied the video file to external storage (it was small enough and not so sensitive if it got abandoned in external storage), played it and when I was done playing it (activity ends) I deleted the external file. Easy peezie.

Joshua Pinter
  • 45,245
  • 23
  • 243
  • 245
0

I would use external storage and add the read permission to the manifest before application:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
<application
Greg Marsh
  • 209
  • 1
  • 2
  • 9