Languages
[Edit]
EN

JavaScript - capture video from device camera using input HTML element (mobile devices only)

7 points
Created by:
Welsh
902

In this short article, we would like to show how capture video from mobile device camera using input HTML element and JavaScript.

Mobile web browsers introduced capture attribute in <input type="file" accept="video/*" /> HTML element that can be used to handle video directly from mobile device camera. The idea is simple: instead of file selector, web browser runs camera application forwarding result into web browser input field.

Capture attribute accepts values:

  • capture="user" that enables facing camera,
  • capture="environment" that enables outward camera.

Practical example:

 

See also

Edit
  1. JavaScript - capture image from device camera using input HTML element (mobile devices only)

References

Edit
  1. HTML attribute: capture - MDN Docs

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join