feat(video): base of video refactoring

This commit is contained in:
2026-06-18 02:23:25 +05:30
parent d7c4027328
commit c6894bfea0
20 changed files with 432 additions and 1412 deletions

View File

@@ -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;
},
};