当前位置:   article > 正文

使用webrtc-streamer查看rtsp实时视频_webrtc-streamer.exe

webrtc-streamer.exe

1.下载webrtc-streamer

2.解压运行webrtc-streamer.exe

在浏览器访问127.0.0.1:8000,点击窗口可以看到本机上各窗口实时状态,点击摄像头可以显示摄像头画面。

5.安装phpstudy,并建立网站。(具体过程自己网上搜)

6.打开网站根目录, 新建webrtc文件夹。将下载包html文件夹下webrtcstreamer.js文件和html/libs文件夹下adapter.min.js文件复制到webrtc文件夹下。

7.新建webrtc.html,并修改webrtc-streamer.exe所在IP(第27行),rtsp地址(第28行)

video组件加上muted才会自动播放,否则需要点击才能播放。

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. </head>
  9. <style>
  10. #id__stream {
  11. width: 100%;
  12. height: 100%;
  13. }
  14. </style>
  15. <body>
  16. <div>
  17. <video muted autoplay controls id="id__stream"></video>
  18. </div>
  19. <script src="./webrtcstreamer.js"></script>
  20. <script src="./adapter.min.js"></script>
  21. <script>
  22. // 只获取视频
  23. let constraints = {audio: false, video: true};
  24. let startBtn = document.getElementById('start')
  25. let stopBtn = document.getElementById('stop')
  26. let videoShowControl = document.getElementById('id__stream')
  27. const s = new WebRtcStreamer('id__stream', 'http://192.168.43.102:8000');
  28. s.connect('rtsp://admin:admin@192.168.43.110:554/stream0');
  29. startBtn.onclick = function () {
  30. }
  31. stopBtn.onclick = function () {
  32. videoShowControl.pause();
  33. }
  34. </script>
  35. </body>
  36. </html>

8.在浏览器输入网址(http://192.168.43.102/webrtc/webrtc.html),即可看到rtsp视频

这里一共有三个地址:

webrtc-streamer.exe(html中配置):http://192.168.43.102:8000

rtsp地址(html中配置): rtsp://admin:admin@192.168.43.110:554/stream0

浏览网址(phpstudy中配置):http://192.168.43.102/webrtc/webrtc.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/955182
推荐阅读
相关标签
  

闽ICP备14008679号