index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view class="video-ctl-content">
  3. <view class="video-content">
  4. <video id="myVideo" src="https://wvp.wenhq.top:40001/rtp/34020000001320000103_34020000001320000001.live.mp4"
  5. controls muted autoplay ref="videoPlay"></video>
  6. </view>
  7. <view class="video-compass-content">
  8. <view class="compass">
  9. <view class="compass-btn"></view>
  10. <view class="compass-btn clickable">
  11. <up-icon size="40" color="#fefefe" name="arrow-up" @click="()=> onCommand('up')"></up-icon>
  12. </view>
  13. <view class="compass-btn"></view>
  14. <view class="compass-btn clickable">
  15. <up-icon size="40" color="#fefefe" name="arrow-left" @click="()=> onCommand('left')"></up-icon>
  16. </view>
  17. <view class="compass-btn"></view>
  18. <view class="compass-btn clickable">
  19. <up-icon size="40" color="#fefefe" name="arrow-right" @click="()=> onCommand('right')"></up-icon>
  20. </view>
  21. <view class="compass-btn"></view>
  22. <view class="compass-btn clickable">
  23. <up-icon size="40" color="#fefefe" name="arrow-down" @click="()=> onCommand('down')"></up-icon>
  24. </view>
  25. <view class="compass-btn"></view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script setup lang="ts">
  31. import {ref, watchEffect} from 'vue'
  32. import {videoCommand} from "@/api/device.js";
  33. const props = defineProps({
  34. stream: {
  35. type: String,
  36. default: ""
  37. }
  38. })
  39. const videoPlay = ref(null)
  40. const playStream = ref(null)
  41. const onCommand = (command) => {
  42. videoCommand({
  43. deviceNo: "34020000001320000103",
  44. tunnel: "34020000001320000001",
  45. command
  46. })
  47. }
  48. watchEffect(() => {
  49. playStream.value = props.stream
  50. })
  51. </script>
  52. <script lang="ts">
  53. export default {
  54. options: {
  55. styleIsolation: 'shared',
  56. name: 'video-ctl'
  57. }
  58. }
  59. </script>
  60. <style scoped lang="scss">
  61. .video-ctl-content {
  62. width: 100%;
  63. .video-content {
  64. width: 100%;
  65. display: flex;
  66. align-items: center;
  67. justify-content: center;
  68. }
  69. .video-compass-content {
  70. margin-top: 20rpx;
  71. width: 100%;
  72. display: flex;
  73. align-items: center;
  74. justify-content: center;
  75. .compass {
  76. display: grid;
  77. grid-template-columns: 1fr 1fr 1fr;
  78. .compass-btn {
  79. width: 100rpx;
  80. height: 100rpx;
  81. display: flex;
  82. align-items: center;
  83. justify-content: center;
  84. &.clickable {
  85. background: #3c9cff;
  86. }
  87. }
  88. }
  89. }
  90. }
  91. </style>