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
     <el-dialog class="videoDialog" v-model="videoDialog" title="互动教师1" width="60%" align="center" top="4%">
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
     </el-dialog>
86
     </el-dialog>
86
 </template>
87
 </template>
87
 
88
 
@@ -91,7 +92,7 @@ import { ElCarousel, ElCarouselItem } from "element-plus";
91
 import "vue3-video-play/dist/style.css";
92
 import "vue3-video-play/dist/style.css";
92
 import { videoPlay } from "vue3-video-play";
93
 import { videoPlay } from "vue3-video-play";
93
 import CircleProgress from './CircleProgress.vue';
94
 import CircleProgress from './CircleProgress.vue';
94
-import { getDevice } from '../request/api';
95
+import { getDevice, getVideoUrl } from '../request/api';
95
 
96
 
96
 
97
 
97
 export default ({
98
 export default ({
@@ -104,7 +105,9 @@ export default ({
104
             height: "100%", //播放器高度
105
             height: "100%", //播放器高度
105
             color: "red", //主题色
106
             color: "red", //主题色
106
             title: "互动教室", //视频名称
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
             muted: false, //静音
111
             muted: false, //静音
109
             webFullScreen: false,
112
             webFullScreen: false,
110
             // speedRate: ["0.75", "1.0", "1.25", "1.5", "2.0"], //播放倍速
113
             // speedRate: ["0.75", "1.0", "1.25", "1.5", "2.0"], //播放倍速
@@ -132,7 +135,11 @@ export default ({
132
         const lookVideo = function (src) {
135
         const lookVideo = function (src) {
133
             videoDialog.value = true;
136
             videoDialog.value = true;
134
             // console.log("点击了播放视频", 12312312, "播放路径", src)
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
 // export const getClass = () => get("http://192.168.4.219:12397/ioc-server/wisdomClass/classroomStatistic")
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
 export const getClassDetail = (deviceCode) => service.get(`/wisdomClass/deviceDetail/${deviceCode}`)
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
 export function post(url, params) {
72
 export function post(url, params) {
73
     return new Promise((resolve, reject) => {
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
             resolve(res)
77
             resolve(res)
78
         }).catch(err => {
78
         }).catch(err => {
79
             reject(err)
79
             reject(err)