PhoneGap iOS can't play video using HTML 5

好久不见. 提交于 2019-12-06 01:44:38

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) {
                console.log("gotFS");


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

                    playVideo(filePath);

                }, 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";

        player.appendChild(source);
        player.load();
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!