videoForMod.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <!-- 视频组件外科 -->
  2. <template>
  3. <div class="videoForMod">
  4. <H5PlayerVideo v-if="videoData" :videoProps="videoData"></H5PlayerVideo>
  5. <fullH5PlayerVideo v-if="fullVideoType" :fullVideoProps="fullVideoProps"></fullH5PlayerVideo>
  6. </div>
  7. </template>
  8. <script>
  9. import { iotCameraGetPreviewURLs } from '@/api/screen'
  10. import H5PlayerVideo from '@/components/H5PlayerVideo/H5PlayerVideo.vue'
  11. import fullH5PlayerVideo from '@/components/fullH5PlayerVideo/fullH5PlayerVideo.vue'
  12. export default {
  13. name: 'videoForMod',
  14. components: {
  15. H5PlayerVideo,
  16. fullH5PlayerVideo
  17. },
  18. props:{
  19. deviceNo:{},
  20. },
  21. data() {
  22. return {
  23. width:1396,
  24. height:806,
  25. videoData:null,
  26. //全屏视频参数
  27. fullVideoProps:{},
  28. fullVideoType:false,
  29. }
  30. },
  31. created() {
  32. },
  33. mounted() {
  34. if(this.deviceNo){
  35. this.iotCameraGetPreviewURLs();
  36. }
  37. },
  38. methods: {
  39. iotCameraGetPreviewURLs(){
  40. let obj = {
  41. streamType:1,
  42. cameraIndexCode:this.deviceNo,
  43. protocol: window.location.href.indexOf('https') !== -1 ? 'wss' : 'ws',
  44. }
  45. iotCameraGetPreviewURLs(obj).then(response => {
  46. if(response.data){
  47. this.$set(this, 'videoData', {
  48. width: this.width,
  49. height: this.height,
  50. url: response.data,
  51. })
  52. this.$forceUpdate();
  53. }
  54. })
  55. },
  56. //全屏开启-关闭轮播
  57. stopTime(cameraIndexCode){
  58. this.$set(this,'fullVideoProps',{cameraIndexCode:cameraIndexCode});
  59. this.$set(this,'fullVideoType',true);
  60. },
  61. //全屏关闭-开启轮播
  62. outFullScreen(){
  63. let self = this;
  64. this.$set(this,'fullVideoType',false);
  65. this.$set(this,'fullVideoProps',{});
  66. },
  67. }
  68. }
  69. </script>
  70. <style scoped lang="scss">
  71. .videoForMod {
  72. display: inline-block;
  73. width:1396px;
  74. height:806px;
  75. margin:20px 0 0 20px;
  76. }
  77. </style>