How to display local video in a PhoneGap app?

后端 未结 3 1293
心在旅途
心在旅途 2021-02-09 12:09

How can I display a video in a PhoneGap app for iPad ?

I can\'t find any reference.

相关标签:
3条回答
  • 2021-02-09 12:48

    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 讨论(0)
  • 2021-02-09 12:55

    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)

    0 讨论(0)
  • 2021-02-09 13:01

    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.

    0 讨论(0)
提交回复
热议问题