开发者

How to display local video in a PhoneGap app?

How c开发者_开发知识库an I display a video in a PhoneGap app for iPad ?

I can't find any reference.


In the Ipad's case you should use the html 5 video tag, and an example of its use is the following:

<video controls="controls" autoplay="autoplay">
   <source src="yourVideo.mp4" type="video/mp4" />
   <source src="yourVideo.webm" type="video/webm" />
   <source src="yourVideo.ogv" type="video/ogg" />
</video>

I used it only with the mp4 extension, and my video was encoding with h264 codec for video and AAC codec for audio codec.

In the Android's, I used a Phonegap plugin from github called web Intent (https://github.com/phonegap/phonegap-plugins/tree/master/Android/WebIntent) a example of usage is:

window.plugins.webintent.startActivity({
    action: WebIntent.ACTION_VIEW,
    url: 'http"//yourVideo.mp4'},
    function() {console.log('Is wirking :D!');},
    function() {console.log('Failed to open the URL :( !!');}
 );

resources:

http://diveintohtml5.info/ (html5/ipad/iphone)

http://www.808.dk/?code-html-5-video (html5/ipad/iphone)

http://smus.com/android-phonegap-plugins (Android)


A quick search of the PhoneGap API does not show any way to do so. However, a quick Google Search returns this, which suggests simply using the HTML video tag.


There is a plugin, which allows playing video with phonegap/cordova on Android. It helped a lot in my case. About IOS + Phonegap - it supports video tag (unlike Android + phonegap).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜