@webileapps/react-native-video-downloader
v0.1.18
Published
Download videos or playlists and their licenses for encrypted videos
Downloads
176
Readme
react-native-video-downloader
Download videos or playlists and their licenses for encrypted videos.
iOS does not allow you to provide custom downloaded files. Find the thread and the corresponding comment from a "Apple Media Engineer" https://developer.apple.com/forums/thread/113063
The only response to an AVAssetResourceLoadingRequest for a segment (.ts) file that AVPlayer will accept is a redirect to an HTTP URL. respondWithData will be rejected.
Installation
npm install @webileapps/react-native-video-downloader
Usage
import { DrmType, createDownloadResumable } from '@webileapps/react-native-video-downloader';
const resumable = createDownloadResumable({
title: 'Axinom demo video - single key (HLS; cbcs)',
url: 'https://media.axprod.net/VTB/DrmQuickStart/AxinomDemoVideo-SingleKey/Encrypted_Cbcs/Manifest.m3u8',
drm: {
type: Platform.OS === 'android' ? DrmType.WIDEVINE : DrmType.FAIRPLAY,
licenseServer: 'https://drm-fairplay-licensing.axtest.net/AcquireLicense',
certificateUrl: 'https://vtb.axinom.com/FPScert/fairplay.cer',
contentId: '211ac1dc-c8a2-4575-baf7-fa4ba56c38ac:A4A6324A9D44C6E952CF426DB4685FA9', //optional
licenseToken:
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiNjllNTQwODgtZTllMC00NTMwLThjMWEtMWViNmRjZDBkMTRlIiwibWVzc2FnZSI6eyJ2ZXJzaW9uIjoyLCJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImxpY2Vuc2UiOnsiYWxsb3dfcGVyc2lzdGVuY2UiOnRydWV9LCJjb250ZW50X2tleXNfc291cmNlIjp7ImlubGluZSI6W3siaWQiOiIyMTFhYzFkYy1jOGEyLTQ1NzUtYmFmNy1mYTRiYTU2YzM4YWMiLCJ1c2FnZV9wb2xpY3kiOiJUaGVPbmVQb2xpY3kifV19LCJjb250ZW50X2tleV91c2FnZV9wb2xpY2llcyI6W3sibmFtZSI6IlRoZU9uZVBvbGljeSIsInBsYXlyZWFkeSI6eyJwbGF5X2VuYWJsZXJzIjpbIjc4NjYyN0Q4LUMyQTYtNDRCRS04Rjg4LTA4QUUyNTVCMDFBNyJdfX1dfX0.D9FM9sbTFxBmcCOC8yMHrEtTwm0zy6ejZUCrlJbHz_U',
},
callback: (progress) => {
console.log({ progress, url: item.url });
},
});
// Later
resumable.startDownloadAsync().then(() => {
console.log(`Downloaded`);
}).catch((err) => {
console.error("Failed", err)
});
License
MIT
Made with create-react-native-library