-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·38 lines (37 loc) · 1.27 KB
/
index.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
<html>
<head>
<script src="http://cdn.binaryjs.com/0/binary.js"></script>
<script>
// Connect to Binary.js server
var client = new BinaryClient('ws://localhost:9000');
// Received new stream from server!
client.on('stream', function(stream, meta){
// Buffer for parts
var parts = [];
// Got new data
stream.on('data', function(data){
parts.push(data);
});
stream.on('end', function(){
// Display new data in browser!
var vid = document.createElement("video");
vid.src = (window.URL || window.webkitURL).createObjectURL(new Blob(parts));
vid.type = "video/webm";
vid.autoplay = "true";
vid.loop = "loop";
// vid.controls = "controls"; to show controls if you want
/** Note :
document.body.appendChild(vid); will append the video to the bottom of body
In most cases if you have already defined a div with an id and want to put
video in it do :
var theDiv = document.getElementById("Id_of_div_element");
theDiv.append(vid);
*****/
document.body.appendChild(vid);
});
});
</script>
</head>
<body>
</body>
</html>