Skip to main content

Configuration

Global Config

nametypedefaultdescription
updateFrequencyMSnumber1000How often to update the download progress
maxParallelDownloadsnumber5How many files to download in parallel

To update global config, you can use setConfig function.

import { setConfig, Config, getConfig } from "@twg/react-native-video-stream-downloader";

setConfig({ updateFrequencyMS: 1000, maxParallelDownloads: 5 });

const config: Config = getConfig();

Download Config

nametypedefaultdescription
includeAllTracksbooleanfalseInclude all (audio and text) tracks from stream in the download
expiresAtnumber0Date when the download will expire. Once download is expired, it will be deleted from the device.
import { DownloadOptions } from "@twg/react-native-video-stream-downloader";

const downloadOptions: DownloadOptions = {
includeAllTracks: true,
expiresAt: new Date().getTime() + 1000 * 60 * 60 * 24 * 30, // 30 days
};

// download stream with download options
const downloadStatus = await downloadStream("https://example.com/stream.m3u8", downloadOptions);