index.ts
1007 Bytes
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
import { defHttp } from "@/utils/external/http/axios";
import { useGlobSetting } from '@/hooks/external/setting';
enum Api {
OPEN_FLV = '/rtsp/openFlv',
CLOSE_FLV = '/rtsp/closeFlv',
GET_VIDEO_CONTROL_START = '/video/control/start',
}
export const getOpenFlvPlayUrl = (url: string, browserId: string) => {
const { urlPrefix, apiUrl } = useGlobSetting()
return `${apiUrl || ''}${urlPrefix || ''}${Api.OPEN_FLV}?url=${encodeURIComponent(url)}&browserId=${browserId}`;
};
export const closeFlvPlay = (url: string, browserId: string) => {
return defHttp.get({
url: Api.CLOSE_FLV,
params: {
url: encodeURIComponent(url),
browserId
}
});
};
//gbt28181,获取flv地址
export const getVideoControlStart = ({
deviceId,
channelId,
}: Record<'deviceId' | 'channelId', string>) => {
return defHttp.get<Recordable>(
{
url: `${Api.GET_VIDEO_CONTROL_START}/${deviceId}/${channelId}`,
timeout: 30 * 1000,
},
{
withShareToken: true
}
);
};