-
Notifications
You must be signed in to change notification settings - Fork 0
/
screenshare.php
44 lines (38 loc) · 1.22 KB
/
screenshare.php
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
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="js/jQuery.js"></script>
<title></title>
</head>
<body>
<video style="max-height: 400px;" autoplay id="localScreen"></video>
<script>
var video_constraints = {
mandatory: {chromeMediaSource: 'screen'},
optional: []
};
navigator.webkitGetUserMedia({
video: {
mandatory: {chromeMediaSource: 'screen'}
}}
, successCallback, errorCallback);
function successCallback(stream) {
localStream = stream;
try {
localScreen.src = window.URL.createObjectURL(stream);
localScreen.play();
} catch (e) {
console.log("Error setting video src: ", e);
}
}
function errorCallback(e) {
alert("Can't access media" + e);
}
</script>
</body>
</html>