β β β Uππ»βΊπ«Δπ¬πβ β β β
π¦CODE ACCESS WEBCAM VIA HTML by undercde :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="Display Webcam Stream" name="title">
<title>Display Webcam Stream</title>
<style>
body {
margin: 30px;
}
h1 {
font-family: sans-serif;
color: #666;
}
#container {
width: 500px;
height: 375px;
border: 10px #333 solid;
}
#videoElement {
width: 500px;
height: 375px;
background-color: #666;
}
button {
margin-top: 20px;
font-size: 12px;
font-weight: bold;
padding: 5px;
background-color: white;
border: 5px solid black;
}
button:hover {
background-color: yellow;
}
button:active {
background-color: yellowgreen;
}
</style>
</head>
<body>
<h1>ΠΡΠΎΠ²Π΅ΡΠΊΠ° Π²Π΅Π± ΠΊΠ°ΠΌΠ΅ΡΡ ΠΎΠ½Π»Π°ΠΉΠ½</h1>
<div id="container">
<video autoplay id="videoElement">
</video>
</div>
<button id="stop">Stop Video</button>
<button id="start">Start Video</button>
<script>
var video = document.querySelector("#videoElement");
var stopVideo = document.querySelector("#stop");
var startVideo = document.querySelector("#start");
stopVideo.addEventListener("click", stop, false);
startVideo.addEventListener("click", startWebCam, false);
function startWebCam() {
if (navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({video: true})
.then(function (stream) {
video.srcObject = stream;
})
.catch(function (err0r) {
console.log("Something went wrong!");
});
}
}
function stop(e) {
var stream = video.srcObject;
var tracks = stream.getTracks();
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
track.stop();
}
video.srcObject = null;
}
</script>
</body>
</html>
by undercode
β β β Uππ»βΊπ«Δπ¬πβ β β β
π¦CODE ACCESS WEBCAM VIA HTML by undercde :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="Display Webcam Stream" name="title">
<title>Display Webcam Stream</title>
<style>
body {
margin: 30px;
}
h1 {
font-family: sans-serif;
color: #666;
}
#container {
width: 500px;
height: 375px;
border: 10px #333 solid;
}
#videoElement {
width: 500px;
height: 375px;
background-color: #666;
}
button {
margin-top: 20px;
font-size: 12px;
font-weight: bold;
padding: 5px;
background-color: white;
border: 5px solid black;
}
button:hover {
background-color: yellow;
}
button:active {
background-color: yellowgreen;
}
</style>
</head>
<body>
<h1>ΠΡΠΎΠ²Π΅ΡΠΊΠ° Π²Π΅Π± ΠΊΠ°ΠΌΠ΅ΡΡ ΠΎΠ½Π»Π°ΠΉΠ½</h1>
<div id="container">
<video autoplay id="videoElement">
</video>
</div>
<button id="stop">Stop Video</button>
<button id="start">Start Video</button>
<script>
var video = document.querySelector("#videoElement");
var stopVideo = document.querySelector("#stop");
var startVideo = document.querySelector("#start");
stopVideo.addEventListener("click", stop, false);
startVideo.addEventListener("click", startWebCam, false);
function startWebCam() {
if (navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({video: true})
.then(function (stream) {
video.srcObject = stream;
})
.catch(function (err0r) {
console.log("Something went wrong!");
});
}
}
function stop(e) {
var stream = video.srcObject;
var tracks = stream.getTracks();
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
track.stop();
}
video.srcObject = null;
}
</script>
</body>
</html>
by undercode
β β β Uππ»βΊπ«Δπ¬πβ β β β