Book Image

PhoneGap 4 Mobile Application Development Cookbook

Book Image

PhoneGap 4 Mobile Application Development Cookbook

Overview of this book

Table of Contents (19 chapters)
PhoneGap 4 Mobile Application Development Cookbook
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

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" content="telephone=no" />
            <meta name="msapplication-tap-highlight" content="no" />
            <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum...