Skip to main content

API Reference

Functions

Authorization

registerPlugin(apiKey: string): Promise<boolean>

enables plugin for current app instance

disablePlugin(): Promise<boolean>

disables plugin for current app instance

isRegistered(): boolean

checks if plugin is enabled for current app instance

Configuration

setConfig(config: Config): Promise<void> Experimental

sets global configuration for plugin

see Config

getConfig(): Promise<Config> In Progress

gets global configuration for plugin

see Config

Download Stream

downloadStream(url: string, options?: DownloadOptions): Promise<DownloadStatus>

downloads stream or video from the internet

see DownloadOptions

cancelDownload(id: string): Promise<void>

cancels download of a stream or video

cancelAllDownloads(): Promise<void>

cancels all downloads

pauseDownload(id: string): Promise<void>

pauses download of a stream or video

resumeDownload(id: string): Promise<void>

resumes download of a stream or video

getDownloadStatus(id: string): Promise<DownloadStatus | null>

gets status of a stream or video download

see DownloadStatus

getDownloadsStatus(): Promise<Array<DownloadStatus>>

gets status of all downloads

see DownloadStatus

Track Inspection

getAvailableTracks(url: string): Promise<AvailableTracksByType>

Retrieves the list of available video, audio, and text (subtitle) tracks for a given stream URL.

Parameters

  • url: string - HLS/DASH manifest or MP4 URL for the asset you want to inspect.

Returns

  • Promise<AvailableTracksByType>

Asset

getDownloadedAssets(): Promise<Array<DownloadedAsset>>

gets all downloaded assets

see DownloadedAsset

getDownloadedAsset(id: string): Promise<DownloadedAsset | null>

gets a downloaded asset by id

see DownloadedAsset

deleteDownloadedAsset(id: string): Promise<void>

deletes a downloaded asset by id

deleteAllDownloadedAssets(): Promise<void>

deletes all downloaded assets

deleteQueuedItem(id: string): Promise<void> In Progress

deletes a specific asset from queue

deleteAllQueuedItems(): Promise<void> In Progress

deletes all queued items

expireDownloadedAssetAt(id: string, timestamp: number): Promise<void>

manually sets an expiration timestamp for an asset

Types

Config

interface Config {
// How often to update the download progress (in milliseconds)
// @default 1000
updateFrequencyMS?: number;
// How many files to download in parallel
// @default 1
maxParallelDownloads?: number;
}

DownloadOptions

interface DownloadOptions {
// Whether to check storage space before starting download
// @default false
checkStorageBeforeDownload?: boolean;
// Timestamp (ms since epoch) when the download will expire. Expired assets are removed automatically on app launch (Android only).
expiresAt?: number;
// Whether to download all available tracks (audio, video, subtitles)
// @default false
includeAllTracks?: boolean;
// Explicit track selection by IDs from getAvailableTracks()
tracks?: {
/** Array of video track IDs */
video?: string[];
/** Array of audio track IDs */
audio?: string[];
/** Array of text (subtitle) track IDs */
text?: string[];
};
// DRM configuration for protected content
drm?: DRMConfig;
// Custom metadata to store with the download
metadata?: Metadata;
}

DownloadStatus

interface DownloadStatus {
// Unique identifier for the download
id: string;
// URL of the stream or video
url: string;
// Number of bytes received
receivedBytes?: number;
// Total number of bytes to download
totalBytes?: number;
// Progress of the download (0-1)
progress: number; // 0-1 eg. 0.55
// Status of the download
status:
| "pending"
| "downloading"
| "paused"
| "completed"
| "failed"
| "removed";
// Error message if the download failed
error?: string;
// Metadata associated with the download
metadata?: Metadata;
}

DownloadedAsset

interface DownloadedAsset {
// Unique identifier for the downloaded asset
id: string;
// URL of the stream or video
url: string;
// Path to the file on the device
// Android: URL pointing to cached video file
// iOS: Actual file path to the downloaded video file
pathToFile: string;
// Title of the stream or video
title: string;
// Duration of the stream or video in milliseconds
duration: number;
// Download date as a timestamp (ms since epoch)
downloadDate: number;
// Expiration timestamp (ms since epoch). Once expired, it will be deleted on app launch (Android only).
expiresAt?: number;
// Custom metadata stored with the download
metadata?: Metadata;
}

Metadata

interface Metadata {
/**
* Title of the downloaded asset.
* Used by plugin for file naming.
*/
title?: string;
[key: string]: unknown;
}

Track Types

export type TrackType = 'audio' | 'video' | 'text';

export interface AudioTrack {
id: string;
type: 'audio';
groupId: string;
language?: string;
name: string;
isDefault?: boolean;
autoSelect?: boolean;
uri: string;
}

export interface TextTrack {
id: string;
type: 'text';
groupId: string;
name: string;
isDefault?: boolean;
autoSelect?: boolean;
forced?: boolean;
language?: string;
uri: string;
}

export interface VideoTrack {
id: string;
type: 'video';
bandwidth: number;
codecs?: string;
audioGroupId?: string;
subtitlesGroupId?: string;
captionGroupId?: string;
videoGroupId?: string;
resolution?: { width: number; height: number };
uri: string;
label?: string;
}

export interface AvailableTracksByType {
audio: AudioTrack[];
video: VideoTrack[];
text: TextTrack[];
}
info

See the dedicated Track Selection guide for practical examples of using getAvailableTracks and DownloadOptions.tracks.