网页显示视频的两种方式:
1.使用Vlc插件,浏览器限制火狐50,51 版本。文件见上传。
<object type="application/x-vlc-plugin" id="vlc3" events="True" style="width:300px; height:300px;"> <param name="mrl" id="mr103" value="rtsp://admin:[email protected]:554/Streaming/Channels/101"> <param name="autoplay" value="true"> </object>View Code
2.使用WebRTC将码流到指定服务器中转。文件见上传。运行WEVRTC服务.
<div><video id="video1" autoplay muted preload="auto"></video></div> var webRtcServer1 = null; window.onload = function () { var rtcServerURL; if (location.protocol.toLowerCase().indexOf("http") != -1) { rtcServerURL = location.protocol + "//" + window.location.hostname + ":9876"; } else { rtcServerURL = "http://127.0.0.1:9001";//中转服务器地址 } webRtcServer1 = new WebRtcStreamer("video1", rtcServerURL); webRtcServer1.connect("rtsp://admin:[email protected]:554/Streaming/Channels/101", "", webrtcConfig.options);//rtsp流 window.onbeforeunload = function () { webRtcServer1.disconnect(); return "关闭提示"; }View Code
https://github.com/mpromonet/webrtc-streamer/releases //webrtc exe下载地址
命令行输入webrtc-streamer.exe -H 0.0.0.0:9001启动服务
推荐使用InstallService.bat运行。
标签:视频流,RTSP,webrtc,window,rtcServerURL,location,webRtcServer1,WebRTC From: https://www.cnblogs.com/Evan-Pei/p/17613302.html