import request from '@/service/request' export const getStreams = () => { return request({ url: '/api/streams', method: 'GET' }) } export const getStreamsDetail = (streamPath: string) => { return request({ url: `/api/stream?streamPath=${streamPath}`, method: 'GET' }) } export const getSnap = (streamPath: string) => { return request({ url: `/snap/${streamPath}`, method: 'GET' }) } export const closeStream = (streamPath: string) => { return request({ url: `/api/closestream?streamPath=${streamPath}`, method: 'GET' }) } export const getPullList = () => { return request({ url: '/api/list/pull', method: 'GET' }) } export const stopPull = (url: string) => { return request({ url: `/api/stoppull?url=${url}`, method: 'GET' }) } export const createRtspPull = (params: {streamPath: string, target: string, save: number}) => { return request({ url: '/rtsp/api/pull', method: 'GET', params }) } export const createRtmpPull = (params: {streamPath: string, target: string, save: number}) => { return request({ url: '/rtmp/api/pull', method: 'GET', params }) } export const getPushList = () => { return request({ url: '/api/list/push', method: 'GET' }) } export const stopPush = (url: string) => { return request({ url: `/api/stoppush?url=${url}`, method: 'GET' }) } export const createRtspPush = (params: {streamPath: string, target: string, save: number}) => { return request({ url: '/rtsp/api/push', method: 'GET', params }) } export const createRtmpPush = (params: {streamPath: string, target: string, save: number}) => { return request({ url: '/rtsp/api/push', method: 'GET', params }) } /** 查看存储列表 */ export const getRecordList = (type: 'mp4' | 'ts' | 'flv') => { return request({ url: `/record/api/list?type=${type}`, method: 'GET' }) } /** 正在存储的视频流 */ export const getRecording = () => { return request({ url: '/record/api/list/recording', method: 'GET' }) } /** 开始存储 */ export const postRecord = (params: {type: 'mp4' | 'ts' | 'flv', streamPath: string }) => { return request({ url: '/record/api/start', method: 'GET', params }) } /** 停止录制 */ export const stopRecord = (id: string) => { return request({ url: `/record/api/stop?id=${id}`, method: 'GET' }) } /** 录制播放 */ // url: `/record/${id}.${format}`, export const playRecord = (id: string, format: 'flv'| 'mp4' | 'm3u8' | 'h264'| 'h265') => { return request({ url: `/record/${id}`, method: 'GET' }) } /** 获取配置 RTSP */ export const getConfig = (name: 'RTSP' | 'RTMP' | 'HLS' | 'HDL' | 'GB28181') => { return request({ url: `/api/getconfig?name=${name}`, method: 'GET' }) } /** 保存配置 RTSP */ export const postConfig = (name: 'RTSP' | 'RTMP' | 'HLS' | 'HDL' | 'GB28181', data: string) => { return request({ url: `/api/modifyconfig?name=${name}`, method: 'POST', data }) } export const updateConfig = (name: 'RTSP' | 'RTMP' | 'HLS' | 'HDL' | 'GB28181') => { return request({ url: `/api/updateconfig?name=${name}`, method: 'GET' }) } /** 系统监控 */ export const getSummary = () => { return request({ url: '/api/summary', method: 'GET' }) } /** 系统监控 流 */ export const getMonitorStream = (params: {time: string, streamPath: string}) => { return request({ url: '/monitor/api/list/stream', method: 'GET', params }) } /** 系统监控 轨道 */ export const getMonitorTrack = (params: {time: string, streamPath: string}) => { return request({ url: '/monitor/api/list/track?streamPath=xxxx', method: 'GET', params }) }