I would like to limit video capturing to 30 seconds. As of now the PhoneGap documentation says the following of iOS implementation:
"The duration parameter is not supported. Recording lengths cannot be limited programmatically."
I did find this post which seems to give the solution for a purely objective C implementation:
iPhone: 5 seconds video capture
The question is: Is this something that could "easily" be made into a phonegap plugin or is there some other reason phonegap hasn't been able to implement this? If you think it can be done - any information pointing me in the right direction is much appreciated! Thanks :)
I'm trying to solve the same problem and may have a solution:
The capture.captureVideo() function returns an array of MediaFile objects. Those objects have a MediaFile.getFormatData() method that tells you what the duration of the file is and therefore you could reject the file if its too long...
Here's my solution:
navigator.device.capture.captureVideo(function(mediaFiles) {
mediaFiles[0].getFormatData(function(data) {
if(data.duration > 30) {
/* Tell the user the video is too long */
} else {
/* Video is less than the max duration...all good */
}
});
}, function(error) { /* An error occured */ },
null);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With