PhoneGap / Cordova iOS: Capture video with a time limit (i.e. 30 seconds)

I would like to limit the video capture to 30 seconds. At the moment, PhoneGap documentation says about the implementation of iOS:

"The duration parameter is not supported. The recording duration cannot be limited programmatically."

I found this post that seems to provide a solution for a purely objective C implementation:

iPhone: capture video in 5 seconds

The question is this: can it be “easily” connected to the plug-in for telephone calls, or is there any other reason why the phone game was not able to implement this? If you think this can be done - all the information pointing to me in the right direction is greatly appreciated! Thanks:)

+6
source share
1 answer

I am trying to solve the same problem and may have a solution:

The capture.captureVideo () function returns an array of MediaFile . These objects have a MediaFile.getFormatData () method that tells you what the file length is, and therefore you can reject the file if it is too long ...

Here is 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); 
+4
source

Source: https://habr.com/ru/post/913552/


All Articles