1、页面HTML代码:
<canvas id="video-canvas" style="width: 100%; height: 387px;"></canvas>
<script type="text/javascript" src="<%=basePath%>resources/js/jsmpeg-master/jsmpeg.min.js"></script>
<script type="text/javascript">
var canvas = document.getElementById('video-canvas');
var url = 'ws://' + document.location.hostname + ':' + port + '/';
port = port + 2;
var player = new JSMpeg.Player(url, {
canvas : canvas
});
</script>
2、需要Node做服务端,下载jsmpeg-master