Browse Source

智慧教室视频播放

huliu 1 year ago
parent
commit
0f780bd133
3 changed files with 17 additions and 8 deletions
  1. 11 4
      src/components/right.vue
  2. 3 1
      src/request/api.js
  3. 3 3
      src/request/http.js

+ 11 - 4
src/components/right.vue

@@ -81,7 +81,8 @@
81 81
 
82 82
     <!-- 视频播放弹框 -->
83 83
     <el-dialog class="videoDialog" v-model="videoDialog" title="互动教师1" width="60%" align="center" top="4%">
84
-        <videoPlay v-bind="videoData" @play="onPlay" />
84
+        <videoPlay v-bind="videoData" />
85
+        <!-- {{ videoData.src }} -->
85 86
     </el-dialog>
86 87
 </template>
87 88
 
@@ -91,7 +92,7 @@ import { ElCarousel, ElCarouselItem } from "element-plus";
91 92
 import "vue3-video-play/dist/style.css";
92 93
 import { videoPlay } from "vue3-video-play";
93 94
 import CircleProgress from './CircleProgress.vue';
94
-import { getDevice } from '../request/api';
95
+import { getDevice, getVideoUrl } from '../request/api';
95 96
 
96 97
 
97 98
 export default ({
@@ -104,7 +105,9 @@ export default ({
104 105
             height: "100%", //播放器高度
105 106
             color: "red", //主题色
106 107
             title: "互动教室", //视频名称
107
-            src: "https://cdn.jsdelivr.net/gh/xdlumia/files/video-play/IronMan.mp4", //视频源
108
+            // src: "https://cdn.jsdelivr.net/gh/xdlumia/files/video-play/IronMan.mp4", //视频源
109
+            src: "",
110
+            type: "m3u8",
108 111
             muted: false, //静音
109 112
             webFullScreen: false,
110 113
             // speedRate: ["0.75", "1.0", "1.25", "1.5", "2.0"], //播放倍速
@@ -132,7 +135,11 @@ export default ({
132 135
         const lookVideo = function (src) {
133 136
             videoDialog.value = true;
134 137
             // console.log("点击了播放视频", 12312312, "播放路径", src)
135
-            videoData.src = src
138
+            getVideoUrl({ "rtsp": src }).then((res) => {
139
+                console.log("视频处理", res);
140
+                videoData.src = res.data.httpFlv
141
+            })
142
+            // videoData.src = src
136 143
 
137 144
         }
138 145
         // 播放视频

+ 3 - 1
src/request/api.js

@@ -1,5 +1,5 @@
1 1
 
2
-import { service } from './http'
2
+import { service, post } from './http'
3 3
 
4 4
 
5 5
 // export const getClass = () => get("http://192.168.4.219:12397/ioc-server/wisdomClass/classroomStatistic")
@@ -15,3 +15,5 @@ export const getDevice = () => service.get("/wisdomClass/deviceStatistic")
15 15
 
16 16
 
17 17
 export const getClassDetail = (deviceCode) => service.get(`/wisdomClass/deviceDetail/${deviceCode}`)
18
+
19
+export const getVideoUrl = (data) => service.post(`/ioc-server/camera/getUrl`, data)

+ 3 - 3
src/request/http.js

@@ -71,9 +71,9 @@ export function get(url, params) {
71 71
 
72 72
 export function post(url, params) {
73 73
     return new Promise((resolve, reject) => {
74
-        service.post(url, {
75
-            data: params
76
-        }).then(res => {
74
+        service.post(url,
75
+            params
76
+        ).then(res => {
77 77
             resolve(res)
78 78
         }).catch(err => {
79 79
             reject(err)