VUE+webrtc-streamer 实现实时视频播放(监控设备-rtsp)

效果

下图则启动成功,此时在浏览器访问127.0.0.1:8000可以看到本机监控画面

1、下载webrtc-streamer

地址:https://github.com/mpromonet/webrtc-streamer/releases

2、解压下载包

3、双击webrtc-streamer.exe启动服务

4、将下载包html文件夹下webrtcstreamer.js文件和html/libs文件夹下adapter.min.js文件复制到VUE项目public目录下。在index.html文件里引入这两个js文件


5.页面 中使用

注意:第三步在本机启动服务所以 new WebRtcStreamer(id,serverUrl)中URL传入127.0.0.1端口可

html 复制代码
 <template>
 <div>
     <div class="coTitle">视频</div>
        <video id='video' controls autoplay autobuffer muted preload='auto'
          style='width:90%; height: 290px; margin-left:5%;object-fit: fill;'>
       </video>
 </div>
</template>
 
<script>
export default {
  name: 'index1',
  data() {
    return {
      webRtcServer: null
    }
  },
  mounted() {
    //video:需要绑定的video控件ID
    //127.0.0.1:8000:启动webrtc-streamer的设备IP和端口,默认8000
    this.webRtcServer = new WebRtcStreamer('video', 'http//127.0.0.1:8000')
    //需要查看的rtsp地址
    this.webRtcServer.connect('rtsp://user:password@ip:port/cam/realmonitor?channel=1&subtype=0')
    //rtsp://user:password@ip:port/h264/ch1/main/av_stream--海康
  },
  beforeDestroy() {
    this.webRtcServer.disconnect()
    this.webRtcServer = null
  },
}
</script>
 
<style scoped></style>

6、运行项目可查看监控视频播放效果

文章参考链接:https://blog.csdn.net/liona_koukou/article/details/126605137

相关推荐
民乐团扒谱机8 小时前
【全流程实战】LibTV节点式AI视频工作流落地教程|从剧本到成片可复用流水线,新手/开发者双版本
人工智能·音视频
私人珍藏库14 小时前
[Android] 美颜通 -实时视频通话直播美颜
智能手机·app·音视频·软件·多功能
鹏多多18 小时前
Web浏览器后台离线通知方案实现以及兼容指南
前端·javascript·vue.js
yangmu320318 小时前
Vue3 响应式系统深度解析:从 Proxy 到依赖追踪
前端·javascript·vue.js
VaJoy20 小时前
全面革新⚡️ Vue 3.6 项目工程的基础实现
前端·vue.js
lpfasd12320 小时前
火山引擎 TOS 视频 `Content-Disposition: attachment` 排查实录
音视频·火山引擎
byte轻骑兵21 小时前
【LE Audio】CSIS精讲[1]: 从核心定义到协议基础,读懂多设备协同的底层逻辑
人工智能·音视频·人机交互·蓝牙耳机·le audio·低功耗蓝牙音频
中微极客1 天前
从提示词到产品级视频:生成式AI的工程化实践与工具栈选型(LTX Studio实战)
人工智能·chatgpt·音视频
luoyayun3611 天前
Qt + FFmpeg 视频工具:视频一键压缩功能实现
qt·ffmpeg·音视频·视频压缩
vipbic1 天前
中后台越做越乱后,我用插件化把它救回来了
前端·vue.js