hyperN hyperN - 1 year ago 123
iOS Question

PhoneGap iOS can't play video using HTML 5

I'm building phonegap app and I need to play video in it. I know in order to play video on Android, I need to use one of the plugins available, but to play video on iOS, I can use HTML 5 video tag. I have these lines of code:

<div id="video">
<video id="video01" width="300" height="300" controls>
<source src="images/test2.mp4" type="video/mp4" />

I can see "video box", but I cannot play video for some reason. In console I don't see any errors.

Video I'm using is from this page: http://www.quirksmode.org/html5/tests/video.html

And in iPhone Safari I can load MP4 version from that page without any problems.

Answer Source

I know it has been a while, but I was looking at some of my old questions, and I've noticed that I completely forgot to post solution to my problem.

In the end I've managed to fix the issue using Cordova File api, and solution looks smth. like this:

 window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {

                getFolder(fileSystem, "video", function(folder) {
                    filePath = folder.toURL() + "\/" + "videotest.mp4";


                }, function() {
                    console.log("failed to get folder");

            function() {
                console.log("failed to get filesystem");

function playVideo(uri) {

        var player = document.getElementById("videoPlayer");
        var source = document.createElement("source");

        source.src = uri;
        source.type = "video/mp4";

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download