We've done the first part of our app, which was displaying thumbnails from videos, but we've got to actually record them before we can get anything into our app. In this task, we'll do exactly that—record a new video.
We'll be working in the documentsView.html
file in the www/views
directory, if you want to follow along.
You might think that we'd use the camera code from our previous project, and you'd be partially correct. For iOS, we can indeed use virtually the exact same code to import new videos, but for any platform to record video, we have to use a new API—the CAPTURE
API.
Let's take a look at the code for takeMovie()
:
documentsView.takeMovie = function() { navigator.device.capture.captureVideo(
The CAPTURE
API provides more
methods than simply capturing video; you can capture audio as well (which is similar to using the MEDIA
API in Project 5, Talking to Your App). In our case, we use the captureVideo...