赞
踩
一般诸如海康威视,大华等监控视频流都是推送的rtsp或rtmp流,这些都是无法在浏览器中直接播放的。因此出现了以下几种方法实现在浏览器端播放。
处理该问题的主流方法大概分为以下几种
PS(由于浏览器的更迭以及Flash不在被支持,所以依赖IE和Flash的方法如使用IE浏览器配合VLC插件,通过video.js配合Flash实现网页播放此处不作介绍)
通过WebRTC实现播放
http://127.0.0.1:9001/webrtcstreamer.html?video=你的rtsp流地址
通过代码实现
- <html>
- <head>
- <script src="js/adapter.min.js" ></script>
- <script src="js/webrtcstreamer.js" ></script>
- <script>
- var webRtcServer= null;
- window.onload= function() {
- webRtcServer= new WebRtcStreamer("video","http://ip地址:9001");
- webRtcServer.connect("rtsp地址");
- }
- window.onbeforeunload = function() { webRtcServer.disconnect(); }
- </script>
- </head>
- <body class="body">
- <video id="video" autoplay muted ></video>
- </body>
- <style>
- .body{
- width:100%;
- height:100%;
- padding:0;
- margin:0;
- }
- #video{
- padding:0;
- width:720px;
- height:400px;
- }
- </style>
- </html>

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。