feat(video): base of video refactoring
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import axiosClient from '../axios/axios';
|
||||
import { API_ROUTES } from '@/constants/apiRoutes';
|
||||
import { Video, PaginationParams } from '@/types';
|
||||
import { CompletedVideoResult, Video, PaginationParams } from '@/types';
|
||||
|
||||
/**
|
||||
* Video Service
|
||||
@@ -77,8 +77,23 @@ export const videoService = {
|
||||
/**
|
||||
* Get analysis results for a video
|
||||
*/
|
||||
getVideoResults: async (videoId: string): Promise<any> => {
|
||||
getVideoResults: async (videoId: string): Promise<CompletedVideoResult> => {
|
||||
const response = await axiosClient.get(API_ROUTES.VIDEOS.RESULTS(videoId));
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* Fetch the annotated video as a blob through the authenticated axios client.
|
||||
*
|
||||
* The browser's native `<video src>` request cannot carry the Bearer token,
|
||||
* which makes the protected media endpoint respond with 401. Proxying the
|
||||
* download through axios attaches the auth header (and benefits from the
|
||||
* refresh-on-401 interceptor) so the bytes can be played back locally.
|
||||
*/
|
||||
getAnnotatedVideo: async (url: string): Promise<Blob> => {
|
||||
const response = await axiosClient.get<Blob>(url, {
|
||||
responseType: 'blob',
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user