input calls device recording
HTML5 official document explains: The capture attribute is used to call the device's camera or microphone.
When accept="audio/or video/", capture has only two values, one is user, used to call the camera facing the face (such as the front camera of the mobile phone), and the other is environment, used to call the environment Camera (such as the rear camera of a mobile phone).
When accept="audio", the device microphone is called as long as there is capture, ignoring the user and environment values.
As for the camera and filesystem mentioned online, they were not officially mentioned.
Official document: www.w3.org/TR/2018/REC-html-media-capture-20180201/
iOS complies most with HTML5 specifications, followed by the X5 kernel, and Android webview is basically ignored capture.
Ideally, webview should be developed as follows:
1. When accept="image/", capture="user" calls the front camera, capture="other value" calls the rear camera
2. When accept="video/", capture="user" calls the front video recorder, capture="other value", calls the rear video recorder
3. When accept="image/,video/" , capture="user" calls the front camera, capture="other value" calls the rear camera, default camera, can switchrecording
4. When accept="audio/*", capture=”Empty or any value”, call the recorder
5. When the input does not have capture, the folder options and camera or recorder options are given according to the accppt type
6. Access the folder can be checked when the input contains multiple With multiple files, only a single file can be used to call the system camera or recorder
7. When there is no multiple, only a single file can be used
Determine the device type
var ua = navigator.userAgent.toLowerCase(); if(ua.match(/android/i)) == "android") { alert("android"); } if(ua.match(/iPhone/i)) == "iPhone") { alert("iPhone"); } if(ua.match(/iPad/i)) == "iPad") { alert("iPad"); }
Recommended tutorial: "HTMLTutorial"
The above is the detailed content of How to call camera on mobile phone in HTML5?. For more information, please follow other related articles on the PHP Chinese website!