-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.js
30 lines (28 loc) · 916 Bytes
/
dashboard.js
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
$(document).ready(function()
{
$('#imageBtn').on("click",function(){
$('#fileChooser').click();
});
$('#fileChooser').on("change",function()
{
var reader = new FileReader();
reader.readAsDataURL(this.files[0]);
reader.onload = function(e)
{
$('#canvas').empty();
$('#canvas').append("<img id='img' src='"+e.target.result+"'>");
}
});
$('#cameraBtn').on("click",function()
{
$('#canvas').empty();
$('#canvas').append("<video id='video' height='380' autoplay></video>");
var video = document.getElementById('video');
if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({ video: true }).then(function(stream) {
video.srcObject = stream;
video.play();
});
}
});
});