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.

  • Can I use any HTML or JavaScript API to get the file's path in input[type=file]?
  • Escaping backslash in string - javascript
  • How to read a txt from an Open File dialog and load the content in a textarea with javascript (jquery)?
  • Check if a file exist in the Server in ASP.NET
  • Angular ng-file-upload - What is ngfBlobUrl and how to convert back and forth
  • Cross Browser Cross OS File Dialog (with ability to select directory only as well as files) Non Java
  • If anyone’s got any ideas, that’d be great. Thanks!

  • Javascript loading CSV file into an array
  • Saving file on IE11 with FileSaver
  • Dynamically load a JavaScript file
  • js: input file to json with for example JSON.stringify
  • Node js check if file is being used by another process
  • javascript - zip a Blob with zip.js
  • 2 Solutions collect form web for “Limiting video record length for input type file on mobile devices”

    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.

    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.