Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limiting video record length for input type file on mobile devices

I'm using the file recording capability for a mobile web app I'm building:

<input id="file-camcorder" type="file" name="camcorder" accept="video/*" capture="camcorder"></input>

I'm wondering if there is a way to somehow limit the length of the video that gets recorded, or to somehow notify the user that their recording is taking too long. The problem is that when you choose to record on a mobile device, you are taken away from the web app, so I don't know of any way to interact with the user while they're in the phone's native recording app.

If anyone's got any ideas, that'd be great. Thanks!

like image 202
mheavers Avatar asked May 06 '14 21:05

mheavers


2 Answers

You will probably have to look into hybrid applications such as Phonegap. HTML 5 alone has a relatively limited access to the device's functions.

Someone mentioned checking the video size or length from the metadata afterwards. That is most likely your only option, if you can not use, say, Phonegap.

To read the metadata, you can use FileReader.

like image 111
Swiffy Avatar answered Oct 14 '22 02:10

Swiffy


Maybe you could try using the html5 tag, attaching your phone's camera video stream as source of the video using getUserMedia like this, and then capturing images from video stream with some delay for a limited number of times (or even prompt the user that they're recording too long after you reach a certain number of frames). Try skimming this and see if it solves your problem.

like image 45
Sasha Avatar answered Oct 14 '22 03:10

Sasha