本文介绍: 将下载包html文件夹下webrtcstreamer.js文件和html/libs文件夹下adapter.min.js文件复制到VUE项目public目录下。在index.html文件里引入这两个js文件。下载https://github.com/mpromonet/webrtc-streamer/releases。如下图则启动成功,此时在浏览器访问127.0.0.1:8000可以看到本机监控画面。然后在引入的页面按照最上面的代码写就行了。index.html中引入。
先上代码
<template>
  <div>
  	video的配置自己写
    <video id="video" autoplay width="900" height="900"></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', location.protocol + '//127.0.0.1:8000')
    //需要查看的rtsp地址
    this.webRtcServer.connect(这里写你的地址')
    //rtsp://user:password@ip:port/h264/ch1/main/av_stream--海康
    //rtsp://user:password@ip:port/cam/realmonitor?channel=1&subtype=0--大华
  },
  beforeDestroy() {
    this.webRtcServer.disconnect()
    this.webRtcServer = null
  },
  methods: {
    
  }
}
</script>
 
<style scoped></style>

下面准备webrtc-streamer
下载https://github.com/mpromonet/webrtc-streamer/releases
在这里插入图片描述
下载后解压
然后启动exe文件
如下图则启动成功,此时在浏览器访问127.0.0.1:8000可以看到本机监控画面
在这里插入图片描述
将下载包html文件夹下webrtcstreamer.js文件和html/libs文件夹下adapter.min.js文件复制到VUE项目public目录下。在index.html文件里引入这两个js文件
在这里插入图片描述
index.html中引入
在这里插入图片描述
然后在引入的页面按照最上面的代码写就行了。

原文地址:https://blog.csdn.net/YhWyl527/article/details/134881471

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。

如若转载,请注明出处:http://www.7code.cn/show_51113.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注