WebRTC 显示RTSP视频流
2023-08-08 09:15 Evan.Pei 阅读(750) 评论(0) 编辑 收藏 举报网页显示视频的两种方式:
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:yado1234@172.16.6.219:554/Streaming/Channels/101"> <param name="autoplay" value="true"> </object>
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:yado1234@172.16.6.219:554/Streaming/Channels/101", "", webrtcConfig.options);//rtsp流 window.onbeforeunload = function () { webRtcServer1.disconnect(); return "关闭提示"; }
https://github.com/mpromonet/webrtc-streamer/releases //webrtc exe下载地址
命令行输入webrtc-streamer.exe -H 0.0.0.0:9001启动服务
推荐使用InstallService.bat运行。
--------------------------------------------------上面的方法很占CPU,下面邹工已经优化,推荐
见csdn文件 WebRtc视频流.rar https://download.csdn.net/download/qq_32768235/88225558
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2017-08-08 软件注册