Configuration
Global Config
name | type | default | description |
---|---|---|---|
updateFrequencyMS | number | 1000 | How often to update the download progress |
maxParallelDownloads | number | 5 | How 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
name | type | default | description |
---|---|---|---|
includeAllTracks | boolean | false | Include all (audio and text) tracks from stream in the download |
expiresAt | number | 0 | Date 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);