Phonegap 2.3 and Android with HTML5 video tag in 2013

两盒软妹~` 提交于 2019-11-29 07:48:29

问题


I know this has been asked many times and most have the same answer: "Use the videplayer plugin". But this is not the way some of us would like to play a video, we want to play in inline. And according to me there is not answer.

http://simonmacdonald.blogspot.ca/2012/10/partial-support-for-video-tag-in.html

Can any one give an answer that plays the video inline in the phonegap webview?

I know poeple are playing html5 video tags in the Android webview (inline), building their own webviews, so what is the problem with phonegap?

I mean can android devices seriously not play html5 video in the phonegap webview in 2013??

Even trying this: (apparently you cant play videos out off the assets folder)

<video id="1" autobuffer width="100%" tabindex="0">
         <source src="file:///videos/video3.mp4" type="video/mp4" />
        </video>

Does not work

<script type="text/javascript">

    $(function(){
        $("video")[0].play()
    });
</script>

Manifest.xml:

<application android:icon="@drawable/icon" android:label="@string/app_name"
        android:hardwareAccelerated="true"
        android:debuggable="true">

回答1:


I recently ran into this problem and created a plugin that accomplishes what you are trying to do.

Here is the repository: https://github.com/jaeger25/Html5Video




回答2:


Here's an example app that, on the loadRemoteFileFromHTTP branch, successfully loads a video file in a webview from a remote location. On the loadLocalFileUsingFileReader branch, the test.m4v file exists on the SD Card of he the device by being referenced as file:///mnt/sdcard/external_sd/test.m4v. The gotcha is when you trying to include the video file in your App. There's no way to use the file:/// protocol to reference something in your App and you cannot use relative URLs for referencing videos in a WebView. In other words, if you have your video file in your assets/www directory and you set src to "nameOfVideo.mp4", it plain won't work :(. See the loadLocalFileUsingRelativeURL branch for an example.

Here's a bug report on the Relative URL issue.



来源:https://stackoverflow.com/questions/14810170/phonegap-2-3-and-android-with-html5-video-tag-in-2013

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