Access Camera in Mobile Devices using Visualforce Pages

Visualforce Feb 2, 2015

Audio/Video capture has been the "Holy Grail" of web development for a long time. For many years we've had to rely on browser plugins (Flash or Silverlight) to get the job done.

HTML5 to the rescue. It might not be apparent, but the rise of HTML5 has brought a surge of access to device hardware. And So in HTML5 to the rescue. It might not be apparent, but the rise of HTML5 has brought a surge of access to device hardware. And so in Visualforce pages

So here is how you can access camera in Visualforce Pages,

<apex:inputFile value="{!doc.Body}"  accept="image/*;capture=camera" filename="{!doc.Title}" />

This is as simple as how you upload document into Objects using Visualforce but difference is accept="image/*;capture=camera" Thats it!!!

Sounds like Interesting? Recording a video or audio is similar: (in HTML)

<input type="file" accept="video/*;capture=camcorder">
<input type="file" accept="audio/*;capture=microphone">

Happy Coding!!!

Phanindra Mangipudi

Salesforce, Lightning Web Componets, Node.Js, Angular 2+, Bootstrap