windows基于webrtc-streamer的rtsp播放(html)

1. 先下载相应版本的webrtc-streamer

https://github.com/mpromonet/webrtc-streamer/releases
在这里插入图片描述

2. 编辑html/index.html文件

<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>

<body>
	<div style="width: 100%;height: 100%;">
		<video id="video" muted controls />
	</div>
	<script src="html/libs/adapter.min.js"></script>
	<script src="html/webrtcstreamer.js"></script>
	<script>
		let options = "rtptransport=tcp";
		var webRtcServer = null;
		window.onload = function () {
			webRtcServer = new WebRtcStreamer("video", "http://127.0.0.1:9001");//这里填你自己部署的WebRtcStreamer服务地址
			//rtsp://user:password@ip:port/h264/ch1/main/av_stream--海康
			//rtsp://user:password@ip:port/cam/realmonitor?channel=1&subtype=0--大华
			//webRtcServer.connect("rtsp://admin:password@ip:554/ch1/main/av_stream", null, options); //这里填可以正常预览的rtsp地址,可以先使用vlc或其他软件测试一下地址的有效性
			webRtcServer.connect("rtsp://127.0.0.1:8554/video", null, options);
		}
		window.onbeforeunload = function () { webRtcServer.disconnect(); }
	</script>
</body>

</html>

3.修改config.js文件

修改海康的rtsp地址
在这里插入图片描述

4.找到文件目录cmd运行webrtc-streamer.exe -H 0.0.0.0:9001


5.运行index.html文件

在这里插入图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值