-
Notifications
You must be signed in to change notification settings - Fork 4
/
screen_viewer.html
85 lines (72 loc) · 2.21 KB
/
screen_viewer.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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
video {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
z-index: -100;
}
body, ul {
color: #fff;
padding: 0;
margin: 0;
}
.logList {
position: absolute;
top: 0px;
left: 0px;
}
li {
list-style: none;
padding: 0;
margin: 10px;
}
span {
font-size: 1em;
}
</style>
<script src="js/jquery-1.9.1.min.js"></script>
<script src="//openflint.github.io/flint-web-sdk/out/flint_receiver_sdk.js"></script>
</head>
<body>
<video id="video" autoplay></video>
<ul class="logList"></ul>
<script>
var PeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
var SessionDescription = window.RTCSessionDescription || window.mozRTCSessionDescription || window.webkitRTCSessionDescription;
var RTCIceCandidate = window.RTCIceCandidate || window.mozRTCIceCandidate;
var video = document.getElementById('video');
function log(message) {
// $('.logList').prepend('<li>' + message + '</li>')
console.log(message);
}
function randomToken() {
return Math.random().toString(36).substr(2);
}
try {
var manager = new FlintReceiverManager('~a3ad1b9e-6883-11e4-b116-123b93f75cba');
var peer = manager.createMediaPeer();
peer.on('call', function (call) {
console.error("received call");
call.answer(null);
console.error("receiver answer");
call.on('stream', function (remoteStream) {
console.log("receiver on stream!!!!!!");
var moz = !!navigator.mozGetUserMedia;
video[moz ? 'mozSrcObject' : 'src'] = moz ? remoteStream : window.URL.createObjectURL(remoteStream);
});
});
manager.open();
log('FlintReceiverManager is started !');
} catch (e) {
log(e.toString());
}
</script>
</body>
</html>