index.ts
975 Bytes
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,
},
{}
);
};