H5 calls the camera implementation method. h5 calls the camera
Copy XML/HTML Code to clipboard
- <! DOCTYPE html>
- <Html lang = "zh-CN">
- <Head>
- <Meta charset = "UTF-8">
- <Title> GetUserMedia instance </title>
- </Head>
- <Body>
- <Video id = "video" autoplay> <ideo>
- </Body>
- <Script type = "text/javascript">
- Var getUserMedia = (navigator. getUserMedia | navigator. webkitGetUserMedia | navigator. mozGetUserMedia | navigator. msGetUserMedia );
- GetUserMedia. call (navigator ,{
- Video: true,
- Audio: true
- }, Function (localMediaStream ){
- Var video = document. getElementById ('video ');
- Video. src = window. URL. createObjectURL (localMediaStream );
- Video. onloadedmetadata = function (e ){
- Console. log ("Label:" + localMediaStream. label );
- Console. log ("AudioTracks", localMediaStream. getAudioTracks ());
- Console. log ("VideoTracks", localMediaStream. getVideoTracks ());
- };
- }, Function (e ){
- Console. log ('reeeejected! ', E );
- });
- </Script>
- <Html>
The above h5 call camera implementation method is all the content shared by xiaobian. I hope you can give us a reference, and hope you can support the help house.