html ask for camera access

Solutions on MaxInterview for html ask for camera access by the best coders in the world

showing results for - "html ask for camera access"
Norman
08 Oct 2020
1var video = document.querySelector("#videoElement");
Loann
06 Nov 2019
1if (navigator.mediaDevices.getUserMedia) {
2  navigator.mediaDevices.getUserMedia({ video: true })
3    .then(function (stream) {
4      video.srcObject = stream;
5    })
6    .catch(function (err0r) {
7      console.log("Something went wrong!");
8    });
9}
Mckenzie
02 Aug 2019
1<!DOCTYPE html>
2<html>
3<head>
4<meta charset="utf-8">
5<title>Display Webcam Stream</title>
6 
7<style>
8#container {
9	margin: 0px auto;
10	width: 500px;
11	height: 375px;
12	border: 10px #333 solid;
13}
14#videoElement {
15	width: 500px;
16	height: 375px;
17	background-color: #666;
18}
19</style>
20</head>
21 
22<body>
23<div id="container">
24	<video autoplay="true" id="videoElement">
25	
26	</video>
27</div>
28<script>
29
30</script>
31</body>
32</html>
Iona
14 Oct 2016
1if (navigator.mediaDevices.getUserMedia) {
2  navigator.mediaDevices.getUserMedia({ video: true })
3    .then(function (stream) {
4      video.srcObject = stream;
5    })
6    .catch(function (err0r) {
7      console.log("Something went wrong!");
8    });
9}
Emiliano
28 Jun 2019
1function stop(e) {
2  var stream = video.srcObject;
3  var tracks = stream.getTracks();
4
5  for (var i = 0; i < tracks.length; i++) {
6    var track = tracks[i];
7    track.stop();
8  }
9
10  video.srcObject = null;
11}
Micah
02 Sep 2019
1var video = document.querySelector("#videoElement");
2
3if (navigator.mediaDevices.getUserMedia) {
4  navigator.mediaDevices.getUserMedia({ video: true })
5    .then(function (stream) {
6      video.srcObject = stream;
7    })
8    .catch(function (err0r) {
9      console.log("Something went wrong!");
10    });
11}
Paul
07 Jul 2018
1if (navigator.mediaDevices.getUserMedia) {
2  navigator.mediaDevices.getUserMedia({ video: true })
3    .then(function (stream) {
4      video.srcObject = stream;
5    })
6    .catch(function (err0r) {
7      console.log("Something went wrong!");
8    });
9}