图书馆综合管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.8 KiB

  1. <template>
  2. <div style="width: 100%; height: 100%; overflow: hidden;">
  3. <!-- <h1>海康威视视频流</h1> -->
  4. <!-- <h3>400W</h3>
  5. <VideoCom :rtsp="rtspurl1" ref="video1"></VideoCom>
  6. <h3>800W</h3>
  7. <VideoCom :rtsp="rtspurl2" ref="video2"></VideoCom> -->
  8. <video id="video" controls autoplay muted width="100%" height="100%" />
  9. </div>
  10. </template>
  11. <script>
  12. // import VideoCom from '../components/video'
  13. // rtsp://admin:ftzn83560792@192.168.99.23:554/h264/ch1/main/av_stream
  14. // rtsp://admin:ftzn83560792@192.168.99.26:554/Streaming/Channels/101
  15. export default {
  16. name: 'Home',
  17. components: {
  18. // VideoCom
  19. },
  20. props: {
  21. hkConfig: {
  22. type: Object,
  23. required: true
  24. }
  25. },
  26. data() {
  27. return {
  28. webRtcServer: null,
  29. camera_ip: '127.0.0.1:8000'
  30. }
  31. },
  32. created() {
  33. // this.controlVolume()
  34. },
  35. mounted() {
  36. // video:需要绑定的video控件ID
  37. // 127.0.0.1:8000:启动webrtc-streamer的设备IP和端口,默认8000
  38. // eslint-disable-next-line no-undef
  39. this.webRtcServer = new WebRtcStreamer('video', location.protocol + '//' + this.camera_ip)
  40. // 需要查看的rtsp地址,根据自己的摄像头传入对应的rtsp地址即可。注意:视频编码格式必须是H264的,否则无法正常显示,编码格式可在摄像头的后台更改
  41. this.webRtcServer.connect('rtsp://' + this.hkConfig.username + ':' + this.hkConfig.password + '@' + this.hkConfig.ip + ':' + this.hkConfig.port + '/h264/ch1/main/av_stream')
  42. },
  43. // 销毁视频流
  44. beforeDestroy() {
  45. this.webRtcServer.disconnect()
  46. this.webRtcServer = null
  47. },
  48. methods: {
  49. controlVolume() {
  50. this.$nextTick(() => {
  51. this.$refs.video1.volume = 0
  52. this.$refs.video2.volume = 0
  53. })
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="scss">
  59. </style>