index.ts 899 Bytes
import { defHttp } from '@/utils/http'

enum Api {
  GET_VIDEO_LIST = '/video',
  STREAMING_PLAY_GET_URL = '/video/url',
  RTSP_CLOSEFLV = '/rtsp.closeFlv',
}

// 获取视频组件--->频流
export const getVideoList = (organizationId?: string) => {
  return defHttp.get({
    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}`,
  })
}