Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display local video in a PhoneGap app?

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

I can't find any reference.

like image 398
wezzy Avatar asked Jan 31 '11 17:01

wezzy


3 Answers

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)

like image 181
McSas Avatar answered Nov 16 '22 19:11

McSas


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.

like image 22
Moshe Avatar answered Nov 16 '22 20:11

Moshe


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).

like image 1
V.Vachev Avatar answered Nov 16 '22 18:11

V.Vachev