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

Capturing a video using the device video recording application


PhoneGap, through the media plugin API, provides us with the ability to easily access the native video recording application on our mobile device and save the captured footage.

How to do it...

We will use the Capture object and the captureVideo method that it contains to invoke the native video recording application:

  1. Firstly, create a new PhoneGap project named videorecording by running the following command:

    phonegap create videorecording com.myapp.videorecording videorecording
    
  2. Add the device's platform. You can choose to use Android, iOS, or both:

    cordova platform add ios
    cordova platform add android
    
  3. Add the media and file-transfer plugins by running the following commands:

    cordova plugin add org.apache.cordova.media
    cordova plugin add org.apache.cordova.file-transfer
    
  4. Open www/index.html. Let's clean up the unnecessary elements. We will use jQuery Mobile, so we have to make a reference. We'll also set a style sheet reference pointing...