title: Can a videoview play a video stored on internal storage?
body: <p>I'm trying to provide my users with the ability to use either external or internal storage. I'm displaying both images and videos (of a scientific nature). When storing the media on the SD card, all is fine. But when I store the media internally, only the images will display. No matter what I try I get various errors when trying to load and display the media stored under the applicationcontext.getFilesDir().</p>
  
  <p>Is there a trick to setting a videoview's content to such a file? </p>
  
  <p>Can a ContentResolver help me?</p>
  
  <p>On a related note, is it considered bad form to assume that external storage exists?</p>
  
  <p>Thanks in advance,</p>
  
  <p>Sid</p>
  
  <p>Below is one version that fails with "Cannot play video. Sorry, this video cannot be played". But I have many other modes of failure. I can copy the internal video to temp storage (external) and play it, so this copy to internal does indeed create a valid movie. It only fails when I try to play it directly from the internal storage.</p>
  
  <pre><code>videoFile = new File(this.getFilesDir() + File.separator + "test.mp4");
  
  
  InputStream data = res.openRawResource(R.raw.moviegood);
  
  
  try {
      OutputStream myOutputStream = new FileOutputStream(videoFile);
  
  
      byte[] buffer = new byte[8192];
      int length;
      while ( (length = data.read(buffer)) &gt; 0 ) {
          myOutputStream.write(buffer);
      }
  
      //Close the streams
      myOutputStream.flush();
      myOutputStream.close();
      data.close();
  } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }
  
  
  
  
  vview.setKeepScreenOn(true);
  vview.setVideoPath(videoFile.getAbsolutePath());
  vview.start();
  </code></pre>