index.ts 622 Bytes
import { defHttp } from "@/utils/external/http/axios";
import { useGlobSetting } from '@/hooks/external/setting';
enum Api {
  OPEN_FLV = '/rtsp/openFlv',
  CLOSE_FLV = '/rtsp/closeFlv'
}

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
    }
  });
};