title: Play video file from internal storage android using VideoView
body: <p>Am trying to play a video stored in the internal storage in Android. However, no matter what I do it keeps coming back with either a -1 error or a -38 error. Both seem to be rather generic errors hence are not much intelligible.</p>
  
  <p>I am wondering if it is possible to use a VideoView and not a MediaPlayer instance to play a video file from the local storage.</p>
  
  <p>The steps involved in my app include, </p>
  
  <ol>
  <li>downloading a file from a remote url </li>
  <li><p>Storing the file in internal
  storage (note i use the convention for ensuring that it has global
  read permissions. i.e</p>
  
  <pre><code>openFileOutput(file_name, Context.MODE_WORLD_READABLE);
  </code></pre></li>
  <li><p>Reading the media file back at a later point from this location, and playing it in a videoView.</p>
  
  <pre><code>String filePath = "file://" + getFilesDir()+File.separator+file_name;
  Uri videoUri = Uri.parse(filePath);
  Log.d("Video Player", filePath);
  videoPlayer.setVideoURI(videoUri);
  </code></pre></li>
  </ol>
  
  <p>I also went through other links in StackOverflow which point out that I need to implement a CustomContentProvider to be able to read these files. Is there a direct way of accessing the file uri and setting it to the videoView without having to resorting to creating a custom content provider and using a mediaPlayer instead of a videoView.</p>
  
  <p>Other StackOverflow references used</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/9067468/android-load-video-from-private-folder-of-app">Android - Load video from private folder of app</a></li>
  <li><a href="https://stackoverflow.com/questions/3038474/can-a-videoview-play-a-video-stored-on-internal-storage">Can a videoview play a video stored on internal storage?</a></li>
  </ol>