title: Video Tag Local File Download Cordova Android
body: <p>I'm trying to download a video and then play it using apache Cordova 3.4.0, but I don't know if I can use the video tag. There are some plugins that work for using the video tag like<br />
  <a href="https://github.com/jaeger25/Html5Video" rel="nofollow noreferrer">Html5Video</a> but it needs the video file to be present in the app folder. There are other plugins that use other players and load the file using the file path, but since the file download now uses Html5 urls, and the fullPath gives me a realitive path to the file system, it's really impossible to know where the file was saved, or the path to give to a video player. Is there a way to access the app folder location and put the video in such a way that it can be found by cordova and played?</p>
  <p>This is what I have so far, but I don't know how to find the video.</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;!--
      Licensed to the Apache Software Foundation (ASF) under one
      or more contributor license agreements.  See the NOTICE file
      distributed with this work for additional information
      regarding copyright ownership.  The ASF licenses this file
      to you under the Apache License, Version 2.0 (the
      &quot;License&quot;); you may not use this file except in compliance
      with the License.  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
      Unless required by applicable law or agreed to in writing,
      software distributed under the License is distributed on an
      &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
      specific language governing permissions and limitations
      under the License.
  --&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta charset=&quot;utf-8&quot; /&gt;
          &lt;meta name=&quot;format-detection&quot; content=&quot;telephone=no&quot; /&gt;
          &lt;!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 --&gt;
          &lt;meta name=&quot;viewport&quot; content=&quot;user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi&quot; /&gt;
          &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;css/index.css&quot; /&gt;
          &lt;title&gt;Hello World&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div class=&quot;app&quot;&gt;
              &lt;h1&gt;Apache Cordova&lt;/h1&gt;
              &lt;div id=&quot;deviceready&quot; class=&quot;blink&quot;&gt;
                  &lt;p class=&quot;event listening&quot;&gt;Connecting to Device&lt;/p&gt;
                  &lt;p class=&quot;event received&quot;&gt;Device is Ready&lt;/p&gt;
              &lt;/div&gt;
              &lt;div id=&quot;video_container&quot;&gt;
                  Loading Video...
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;script type=&quot;text/javascript&quot; src=&quot;cordova.js&quot;&gt;&lt;/script&gt;
          &lt;script type=&quot;text/javascript&quot; src=&quot;js/index.js&quot;&gt;&lt;/script&gt;
          &lt;script type=&quot;text/javascript&quot;&gt;
              app.initialize();
  
              document.addEventListener(&quot;deviceready&quot;, onDeviceReady, false);
  
              // device APIs are available
              //
              function onDeviceReady() {
                  console.log('Requesting file system');
                  window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
              }
  
              function gotFS(fileSystem) {
                  fileSystem.root.getDirectory(&quot;vids&quot;, {create: true}, gotDir);
              }
  
              function gotDir(dirEntry) {
                  dirEntry.getFile(&quot;some_video.mp4&quot;, {create: true, exclusive: false}, gotFile);
              }
  
              function gotFile(fileEntry) {
                  var localPath = fileEntry.fullPath;
                  var localUrl = fileEntry.toURL();
  
                  console.log('Loaded local path: ' + localPath);
                  console.log('Loaded local url: ' + localUrl);
  
                  var fileTransfer = new FileTransfer();
                  var uri = encodeURI('http//site/with/video.mp4');
                  console.log('Downloading ' + uri + ' to ' + localPath);
  
                  fileTransfer.download(
                      uri,
                      localUrl,
                      function(entry) {
                          console.log('download complete (path): ' + entry.fullPath); // Returns '/vids/some_video.mp4'
                          console.log('download complete (url): ' + entry.toURL()); // Returns 'cdvfile://localhost/persistent/vids/some_video.mp4'
                          document.getElementById('video_container').innerHTML = 
                          'Downloaded Video path: ' + entry.fullPath + '&lt;br /&gt;'
                          + 'Downloaded Video url: ' + entry.toURL() + '&lt;br /&gt;'
                          + '&lt;video width=&quot;100%&quot; height=&quot;300&quot; controls&gt;' 
                          + '&lt;source src=&quot;' + entry.toURL() + '&quot; type=&quot;video/mp4&quot;&gt;'
                          + '&lt;/video&gt;';
                          console.log('Wrote video player');
                      },
                      function(error) {
                          console.log('download error source ' + error.source);
                          console.log('download error target ' + error.target);
                      }
                  );
              }
  
              function fail(error) {
                  console.log('Error creating file [' + error.name + ']: ' + error.message);
              }
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>The file is being correctly downloaded, but how can I have the fullPath once its downloaded? Or move it to my cordova folder to put the url in the video tag?</p>
  <h1>!!! I FOUND A SOLUTION !!!!</h1>
  <p>I got it working with the dev branches as explained <a href="https://stackoverflow.com/questions/21846046/cordova-video-audio-wont-play-from-cdvfile-urls-after-update-to-3-3-0/22103534#22103534">here</a>.</p>