@api.video/video-uploader
Version:
api.video video uploader
104 lines (103 loc) • 4.78 kB
TypeScript
import { ProgressiveUploader } from "./progressive-video-uploader";
import { VideoUploader } from "./video-uploader";
declare type ProgressiveSession = {
uploader: ProgressiveUploader;
partsOnProgress: Record<number, (progress: number) => void>;
currentPart: number;
};
export declare class UploaderStaticWrapper {
static application: {
name: string;
version: string;
};
static sdk: {
name: string;
version: string;
};
static chunkSize: number;
static progressiveUploadSessions: Record<string, ProgressiveSession>;
static standardUploaders: VideoUploader[];
/**
* Sets the application name and version for the SDK.
* @param name - The name of the application using the SDK.
* @param version - The version of the application.
*/
static setApplicationName(name: string, version: string): void;
/**
* Sets the sdk name and version for the SDK.
* @param name - The name of the sdk using the SDK.
* @param version - The version of the sdk.
*/
static setSdkName(name: string, version: string): void;
/**
* Sets the chunk size for the video upload.
* @param chunkSize - The size of each chunk in MB.
*/
static setChunkSize(chunkSize: number): void;
/**
* Creates a new progressive upload session with an upload token.
* @param sessionId - The unique session identifier.
* @param uploadToken - The upload token provided by the backend.
* @param videoId - The ID of the video to be uploaded.
*/
static createProgressiveUploadWithUploadTokenSession(sessionId: string, uploadToken: string, videoId: string): void;
/**
* Creates a new progressive upload session with an API key.
* @param sessionId - The unique session identifier.
* @param apiKey - The API key provided by the backend.
* @param videoId - The ID of the video to be uploaded.
*/
static createProgressiveUploadWithApiKeySession(sessionId: string, apiKey: string, videoId: string): void;
/**
* Uploads a part of a video in a progressive upload session.
* @param sessionId - The unique session identifier.
* @param file - The blob of the video part.
* @param onProgress - The callback to call on progress updates.
* @returns A string containing the JSON representation of the VideoUploadResponse object.
*/
static uploadPart(sessionId: string, file: Blob, onProgress: (progress: number) => void): Promise<string>;
/**
* Uploads the last part of a video in a progressive upload session and finalizes the upload.
* @param sessionId - The unique session identifier.
* @param file - The blob of the video part.
* @param onProgress - The callback to call on progress updates.
* @returns A string containing the JSON representation of the VideoUploadResponse object.
*/
static uploadLastPart(sessionId: string, file: Blob, onProgress: (progress: number) => void): Promise<string>;
/**
* Cancels all ongoing uploads, both progressive and standard.
*/
static cancelAll(): void;
/**
* Disposes a progressive upload session by its ID.
* @param sessionId - The unique session identifier to dispose.
*/
static disposeProgressiveUploadSession(sessionId: string): void;
/**
* Uploads a video with an upload token.
* @param file - The video file to be uploaded.
* @param uploadToken - The upload token provided by the backend.
* @param videoName - The name of the video.
* @param onProgress - The callback to call on progress updates.
* @param videoId - The ID of the video to be uploaded (optional).
* @returns A string containing the JSON representation of the VideoUploadResponse object.
*/
static uploadWithUploadToken(file: Blob, uploadToken: string, videoName: string, onProgress: (event: number) => void, videoId?: string): Promise<string>;
/**
* Uploads a video with an API key.
* @param file - The video file to be uploaded.
* @param apiKey - The API key provided by the backend.
* @param onProgress - The callback to call on progress updates.
* @param videoId - The ID of the video to be uploaded.
* @returns A string containing the JSON representation of the VideoUploadResponse object.
*/
static uploadWithApiKey(file: Blob, apiKey: string, onProgress: (event: number) => void, videoId: string): Promise<string>;
private static getProgressiveSession;
private static storeProgressiveSession;
private static storeStandardUploader;
private static progressiveUploadCreationHelper;
private static uploadPartHelper;
private static uploadHelper;
private static getOriginHeader;
}
export {};