Commit 37b666e03ac03b78b079962147adf32f808ad202
Merge branch 'feat/video-component-support-gbt' into 'main_dev'
feat: 视频组件支持gbt See merge request yunteng/thingskit-front!1232
Showing
4 changed files
with
47 additions
and
20 deletions
... | ... | @@ -13,7 +13,6 @@ export interface CameraModel { |
13 | 13 | accessMode: number; |
14 | 14 | avatar?: string; |
15 | 15 | brand: string; |
16 | - createTime?: '2022-04-19T11:33:13.113Z'; | |
17 | 16 | creator?: string; |
18 | 17 | defaultConfig?: string; |
19 | 18 | description?: string; |
... | ... | @@ -25,16 +24,17 @@ export interface CameraModel { |
25 | 24 | name: string; |
26 | 25 | organizationId: string; |
27 | 26 | organizationName?: string; |
28 | - roleIds?: ['string']; | |
29 | 27 | sn: string; |
30 | 28 | status?: false; |
31 | - tenantExpireTime?: '2022-04-19T11:33:13.113Z'; | |
32 | 29 | tenantId?: string; |
33 | 30 | tenantProfileId?: string; |
34 | - tenantStatus?: 'DISABLED'; | |
35 | - updateTime?: '2022-04-19T11:33:13.113Z'; | |
36 | 31 | updater?: string; |
37 | 32 | videoUrl: string; |
33 | + params?: { | |
34 | + channelNo: string; | |
35 | + deviceId: string; | |
36 | + deviceName: string; | |
37 | + }; | |
38 | 38 | } |
39 | 39 | |
40 | 40 | export interface StreamingManageRecord { | ... | ... |
1 | 1 | import { getCameraList } from '/@/api/camera/cameraManager'; |
2 | 2 | import { CameraModel } from '/@/api/camera/model/cameraModel'; |
3 | 3 | import { FormSchema } from '/@/components/Form'; |
4 | +import { AccessMode } from '/@/views/camera/manage/config.data'; | |
4 | 5 | |
5 | 6 | export enum FormFieldEnum { |
6 | 7 | VIDEO_TYPE = 'type', |
... | ... | @@ -9,6 +10,9 @@ export enum FormFieldEnum { |
9 | 10 | ACCESS_MODE = 'accessMode', |
10 | 11 | VIDEO_ID = 'id', |
11 | 12 | ORGANIZATION_ID = 'organizationId', |
13 | + | |
14 | + DEVICE_ID = 'deviceId', | |
15 | + CHANNEL_ID = 'channelId', | |
12 | 16 | } |
13 | 17 | |
14 | 18 | export interface DataSourceValueType { |
... | ... | @@ -40,16 +44,10 @@ export const formSchemas: FormSchema[] = [ |
40 | 44 | const { setFieldsValue } = formActionType; |
41 | 45 | return { |
42 | 46 | placeholder: '请选择视频来源', |
43 | - options: [ | |
44 | - { | |
45 | - label: VideoOriginalNameEnum[VideoOriginalEnum.CUSTOM], | |
46 | - value: VideoOriginalEnum.CUSTOM, | |
47 | - }, | |
48 | - { | |
49 | - label: VideoOriginalNameEnum[VideoOriginalEnum.VIDEO_MANAGE], | |
50 | - value: VideoOriginalEnum.VIDEO_MANAGE, | |
51 | - }, | |
52 | - ], | |
47 | + options: Object.keys(VideoOriginalEnum).map((value) => ({ | |
48 | + label: VideoOriginalNameEnum[value], | |
49 | + value, | |
50 | + })), | |
53 | 51 | onChange() { |
54 | 52 | setFieldsValue({ |
55 | 53 | [FormFieldEnum.ACCESS_MODE]: null, |
... | ... | @@ -96,6 +94,8 @@ export const formSchemas: FormSchema[] = [ |
96 | 94 | [FormFieldEnum.ACCESS_MODE]: null, |
97 | 95 | [FormFieldEnum.VIDEO_PLAY_URL]: null, |
98 | 96 | [FormFieldEnum.VIDEO_ID]: null, |
97 | + [FormFieldEnum.DEVICE_ID]: null, | |
98 | + [FormFieldEnum.CHANNEL_ID]: null, | |
99 | 99 | }); |
100 | 100 | }, |
101 | 101 | }; |
... | ... | @@ -117,13 +117,30 @@ export const formSchemas: FormSchema[] = [ |
117 | 117 | labelField: 'name', |
118 | 118 | valueField: 'id', |
119 | 119 | resultField: 'data', |
120 | - onChange(value: string, options: CameraModel) { | |
120 | + onChange(_: string, options: CameraModel) { | |
121 | + const accessMode = options?.accessMode; | |
121 | 122 | setFieldsValue({ |
122 | - [FormFieldEnum.ACCESS_MODE]: value ? (options || {}).accessMode : null, | |
123 | - [FormFieldEnum.VIDEO_PLAY_URL]: value ? (options || {}).videoUrl : null, | |
123 | + [FormFieldEnum.ACCESS_MODE]: accessMode, | |
124 | + [FormFieldEnum.VIDEO_PLAY_URL]: options?.videoUrl, | |
125 | + [FormFieldEnum.CHANNEL_ID]: | |
126 | + accessMode === AccessMode.GBT28181 ? options.params?.channelNo : null, | |
127 | + [FormFieldEnum.DEVICE_ID]: | |
128 | + accessMode === AccessMode.GBT28181 ? options.params?.deviceId : null, | |
124 | 129 | }); |
125 | 130 | }, |
126 | 131 | }; |
127 | 132 | }, |
128 | 133 | }, |
134 | + { | |
135 | + field: FormFieldEnum.DEVICE_ID, | |
136 | + label: '设备Id', | |
137 | + component: 'Input', | |
138 | + ifShow: false, | |
139 | + }, | |
140 | + { | |
141 | + field: FormFieldEnum.CHANNEL_ID, | |
142 | + label: '通道号', | |
143 | + component: 'Input', | |
144 | + ifShow: false, | |
145 | + }, | |
129 | 146 | ]; | ... | ... |
... | ... | @@ -10,9 +10,10 @@ |
10 | 10 | import { ref } from 'vue'; |
11 | 11 | import { Spin } from 'ant-design-vue'; |
12 | 12 | import { useFingerprint } from '/@/utils/useFingerprint'; |
13 | - import { isRtspProtocol } from '/@/components/Video/src/utils'; | |
13 | + import { isRtspProtocol, VideoPlayerType } from '/@/components/Video/src/utils'; | |
14 | 14 | import { isShareMode } from '/@/views/sys/share/hook'; |
15 | 15 | import { getJwtToken, getShareJwtToken } from '/@/utils/auth'; |
16 | + import { getVideoControlStart } from '/@/api/device/videoChannel'; | |
16 | 17 | |
17 | 18 | const props = defineProps<{ |
18 | 19 | config: ComponentPropsConfigType<typeof option>; |
... | ... | @@ -46,13 +47,20 @@ |
46 | 47 | const { option } = config; |
47 | 48 | const { videoConfig, uuid } = option || {}; |
48 | 49 | if (!uuid) return; |
49 | - const { url, id, accessMode } = videoConfig || {}; | |
50 | + const { url, id, accessMode, deviceId, channelId } = videoConfig || {}; | |
50 | 51 | let type = getVideoTypeByUrl(url!); |
51 | 52 | let playUrl = url; |
52 | 53 | if (accessMode === AccessMode.Streaming && id) { |
53 | 54 | const { data: { url } = { url: '' } } = await getStreamingPlayUrl(id!); |
54 | 55 | playUrl = url; |
55 | 56 | playUrl && (type = getVideoTypeByUrl(playUrl!)); |
57 | + } else if (accessMode === AccessMode.GBT28181 && deviceId && channelId) { | |
58 | + const { | |
59 | + data: { flv }, | |
60 | + } = await getVideoControlStart({ channelId, deviceId }); | |
61 | + | |
62 | + playUrl = flv; | |
63 | + type = VideoPlayerType.flv; | |
56 | 64 | } |
57 | 65 | |
58 | 66 | if (isRtspProtocol(url!)) { | ... | ... |