I am trying to create a standalone video player that will download video content from my site for later offline viewing using an HTML5 video element. The code below works fine in Chrome for the desktop, but not on the mobile device (Nexus S smartphone, Nexus 7, 4.1 tablet, since it only launches chrome, which is required for the api file system). I use the file system API, which is supported by chrome both on the desktop and on the mobile device.
I confirmed that it stores the file correctly on the mobile device, and I can get the file correctly, but for some reason, after extracting the video from the locals system, chrome does not want to play the video. This is true whether I use the html5 video element or I directly navigate to the file system URL. When I use the html5 video element, it returns a media_err_not_supported error. I confirmed that the device can play video if I go directly to it on my server (without first saving it using the api file system), so the problem is not a codec or video format problem. I also use the mime type video / mp 4 in both cases.
Again, this works on the desktop, but not on mobile devices. Any ideas?
Here is the code we use:
<!DOCTYPE html > <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"> </script> <script type="text/javascript"> var _fs; var filename = "test3.mp4"; var diskSpaceRequired = 10 * 1024 * 1024; $(document).ready(function () { window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; function onInitFs(fs) { _fs = fs; getVideo(fs); } if (!!window.requestFileSystem) { window.webkitStorageInfo.requestQuota( window.webkitStorageInfo.PERSISTENT, diskSpaceRequired, </script> <title>foo</title> </head> <body> <input type="button" value="Play Video" id="play"/> <video id="ourVideo" controls=""> <source id="vidSource" type="video/mp4"/> </video> </body> </html>
source share