webRTC-to-stream/static/index.html

37 lines
1.1 KiB
HTML
Raw Normal View History

2018-05-28 18:33:58 +00:00
<html>
<head>
<title>webRTC to stream</title>
</head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.1/socket.io.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.webrtc-experiment.com/ConcatenateBlobs.js"></script>
<body>
<video style="width: 100%; height: 100%;" id="videoPlayer" controls>
</video>
<script>
$( document ).ready(function() {
var videoPlayer = $('#videoPlayer');
var buffer =[];
var socket = io('https://kurento.fishrungames.com/');
socket.on('connect', (socket) => {
console.log('connected to the socket');
});
socket.on('newBlob', (data) => {
console.log('blob');
buffer.push(new Blob([new Uint8Array(data)]));
ConcatenateBlobs(buffer,'video/webm', (resultingBlob) => {
// blob is immutabl!
// let blob = new Blob([new Uint8Array(data)], { type: "video/webm" });
//videoPlayer.src = URL.createObjectURL(blob);
});
});
});
</script>
</body>
</html>