O'Reilly logo

PhoneGap 4 Mobile Application Development Cookbook by Zainul Setyo Pamungkas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Playing a remote video

In reach media mobile applications, we are often required to play videos from a remote source. PhoneGap can play remote videos by two ways: a plugin or a web API. The simpler way is by using a web API.

How to do it...

Playing a video using PhoneGap can be done by using the HTML5 video tag:

  1. Firstly, create a new PhoneGap project named remotevideo by running this command:
    phonegap create remotevideo com.myapp.remotevideo  remotevideo
    
  2. Add the devices platform. You can choose to use Android, iOS, or both:
    cordova platform add ios
    cordova platform add android
    
  3. Open www/index.html. Let's clean up the unnecessary elements. So, we have the following code:
    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="format-detection" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required