视频直播

<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<metaname="viewport"content="width=device-width, initial-scale=1.0">
<metahttp-equiv="X-UA-Compatible"content="ie=edge">
<title>直播</title>
</head>
<body>
<imgid="receiver"style="width:1000px;height:600px"/>
</body>
<scripttype="text/javascript"charset="utf-8">
//创建一个socket实例
var receiver_socket = new WebSocket("ws://172.16.151.190:7890");
var image = document.getElementById('receiver');
// 监听消息
receiver_socket.onmessage = function(data)
{
image.src=data.data;
}
</script>
</html>
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<metaname="viewport"content="width=device-width, initial-scale=1.0">
<metahttp-equiv="X-UA-Compatible"content="ie=edge">
<title>直播</title>
</head>
<body>
<imgid="receiver"style="width:1000px;height:600px"/>
</body>
<scripttype="text/javascript"charset="utf-8">
//创建一个socket实例
var receiver_socket = new WebSocket("ws://172.16.151.190:7890");
var image = document.getElementById('receiver');
// 监听消息
receiver_socket.onmessage = function(data)
{
image.src=data.data;
}
</script>
</html>
posted @ 2019-04-23 18:10  本木木  阅读(351)  评论(0编辑  收藏  举报