WHAT YOU WILL LEARN IN THIS CHAPTER:
- Understanding how to capture video
- Understanding how to capture audio
- Understanding how to capture images
- Understanding how to handle errors
In earlier chapters, you learned how to use the Media and Camera objects to capture audio and photos, respectively. The PhoneGap API also lets you capture video, audio, and photos with the Capture API.
In this chapter, you learn how to use the Capture objects and methods.
LEARNING ABOUT CAPTURING VIDEO
To capture video on your device, use the device.capture.captureVideo method, as shown here:
navigator.device.capture.captureVideo(onSuccess, onError, options);
The success callback contains the captured video, and the error callback alerts you to any problems that you may encounter. Specifically, the success callback is invoked with an array of MediaFile objects, each describing a captured video clip file.
Using the options Argument
The options argument can contain the following items:
- limit — This is the maximum number of video clips the user can capture at a time. It defaults to 1, but must be greater than or equal to 1.
- duration — This is the maximum duration of the video clip (in seconds).
- mode — This is the selected video capture mode. The value must match a recognized video mode (video/quicktime, video/3gpp, and so on).
NOTE The 3GPP format (sometimes known as 3GP) is a multimedia ...