|
@@ -31,6 +31,11 @@ |
|
@@ -31,6 +31,11 @@ |
|
31
|
import { AccessMode } from './config.data';
|
31
|
import { AccessMode } from './config.data';
|
|
32
|
import { getStreamingPlayUrl } from '/@/api/camera/cameraManager';
|
32
|
import { getStreamingPlayUrl } from '/@/api/camera/cameraManager';
|
|
33
|
|
33
|
|
|
|
|
34
|
+ enum MediaType {
|
|
|
|
35
|
+ MP4 = 'mp4',
|
|
|
|
36
|
+ M3U8 = 'm3u8',
|
|
|
|
37
|
+ }
|
|
|
|
38
|
+
|
|
34
|
const heightNum = ref(800);
|
39
|
const heightNum = ref(800);
|
|
35
|
const showVideo = ref(false);
|
40
|
const showVideo = ref(false);
|
|
36
|
const options = reactive({
|
41
|
const options = reactive({
|
|
@@ -66,13 +71,19 @@ |
|
@@ -66,13 +71,19 @@ |
|
66
|
console.log(video.value);
|
71
|
console.log(video.value);
|
|
67
|
});
|
72
|
});
|
|
68
|
|
73
|
|
|
|
|
74
|
+ const getMediaType = (suffix: string) => {
|
|
|
|
75
|
+ return suffix === MediaType.M3U8 ? suffix : `video/${suffix}`;
|
|
|
|
76
|
+ };
|
|
|
|
77
|
+
|
|
69
|
const [register] = useModalInner(
|
78
|
const [register] = useModalInner(
|
|
70
|
async (data: { record: CameraModel | StreamingManageRecord }) => {
|
79
|
async (data: { record: CameraModel | StreamingManageRecord }) => {
|
|
71
|
- // setModalProps({ destroyOnClose: true });
|
80
|
+ let reg = /(?:.*)(?<=\.)/;
|
|
72
|
const { record } = data;
|
81
|
const { record } = data;
|
|
73
|
if (record.accessMode === AccessMode.ManuallyEnter) {
|
82
|
if (record.accessMode === AccessMode.ManuallyEnter) {
|
|
74
|
if ((record as CameraModel).videoUrl) {
|
83
|
if ((record as CameraModel).videoUrl) {
|
|
|
|
84
|
+ const type = (record as CameraModel).videoUrl.replace(reg, '');
|
|
75
|
showVideo.value = true;
|
85
|
showVideo.value = true;
|
|
|
|
86
|
+ options.type = getMediaType(type);
|
|
76
|
options.src = (record as CameraModel).videoUrl;
|
87
|
options.src = (record as CameraModel).videoUrl;
|
|
77
|
options.autoPlay = true;
|
88
|
options.autoPlay = true;
|
|
78
|
}
|
89
|
}
|
|
@@ -81,10 +92,13 @@ |
|
@@ -81,10 +92,13 @@ |
|
81
|
const { data: { url } = { url: '' } } = await getStreamingPlayUrl(record.id!);
|
92
|
const { data: { url } = { url: '' } } = await getStreamingPlayUrl(record.id!);
|
|
82
|
showVideo.value = true;
|
93
|
showVideo.value = true;
|
|
83
|
options.src = url;
|
94
|
options.src = url;
|
|
|
|
95
|
+ const type = (url as CameraModel).videoUrl.replace(reg, '');
|
|
|
|
96
|
+ options.type = getMediaType(type);
|
|
84
|
} catch (error) {}
|
97
|
} catch (error) {}
|
|
85
|
}
|
98
|
}
|
|
86
|
}
|
99
|
}
|
|
87
|
);
|
100
|
);
|
|
|
|
101
|
+
|
|
88
|
const handleCancel = () => {
|
102
|
const handleCancel = () => {
|
|
89
|
//关闭暂停播放视频
|
103
|
//关闭暂停播放视频
|
|
90
|
options.src = '';
|
104
|
options.src = '';
|