index.ts
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import type { VideoChannelPlayAddressType, VideoItemRecordType } from './model'
import { defHttp } from '@/utils/http'
enum Api {
GET_VIDEO_LIST = '/video',
STREAMING_PLAY_GET_URL = '/video/url',
GET_VIDEO_ALL_LIST = '/video/list',
RTSP_CLOSEFLV = '/rtsp.closeFlv',
GET_VIDEO_CONTROL_START = '/video/control/start',
GET_VIDEO_CONTROL_STOP = '/video/control/stop',
}
// 获取视频组件--->频流
export const getVideoList = (organizationId?: string) => {
return defHttp.get<{ items: VideoItemRecordType[] }>({
url: Api.GET_VIDEO_LIST,
params: {
organizationId,
page: 1,
pageSize: 100,
},
})
}
// 获取流媒体播放地址
export const getStreamingPlayUrl = (entityId: string) => {
return defHttp.get({
url: `${Api.STREAMING_PLAY_GET_URL}/${entityId}`,
})
}
export const getFlvPlayUrl = (url: string, browserId: string) => {
return `/api/yt/rtsp/openFlv?url=${encodeURIComponent(url)}&browserId=${browserId}`
}
export const closeFlvPlay = (url: string, browserId: string) => {
return defHttp.get({
url: `/rtsp/closeFlv?url=${encodeURIComponent(url)}&browserId=${browserId}`,
})
}
export const getVideoControlStart = ({
deviceId,
channelId,
}: Record<'deviceId' | 'channelId', string>) => {
return defHttp.get<VideoChannelPlayAddressType>(
{
url: `${Api.GET_VIDEO_CONTROL_START}/${deviceId}/${channelId}`,
timeout: 30 * 1000,
},
{},
)
}
export const getCameraList = (params: Record<'organizationId', string>) => {
return defHttp.get<{ data: VideoItemRecordType[] }>({
url: Api.GET_VIDEO_ALL_LIST,
params,
})
}