arch_ang_paul
v0.1.35
Published
Cross-platform DRM video player SDK for React Native with online and offline playback.
Maintainers
Readme
arch_ang_paul
arch_ang_paul is a cross-platform React Native DRM video player SDK for Android and iOS. It exposes the ArchAngPaulPlayer component, the promise-based ArchAngDownloader API, TypeScript definitions, Expo config plugin support, old architecture autolinking, and a new-architecture codegen contract.
The native foundation uses Kotlin + ExoPlayer Media3 on Android and Swift + AVFoundation on iOS. The SDK is designed for React Native 0.64+, Hermes, Android API 23+, and iOS 13+.
Installation
npm install arch_ang_paul
cd ios && pod installFor Expo prebuild projects:
{
"expo": {
"plugins": [
[
"arch_ang_paul",
{
"android": {
"usesCleartextTraffic": false
},
"ios": {
"allowsAirPlay": true,
"allowsArbitraryMediaLoads": false
}
}
]
]
}
}Basic Usage
import React from 'react';
import { ArchAngPaulPlayer, ArchAngDownloader } from 'arch_ang_paul';
export function MovieScreen() {
return (
<ArchAngPaulPlayer
source={{
uri: 'https://domain.com/movie.mpd',
type: 'dash',
}}
drm={{
type: 'widevine',
licenseUrl: 'https://license.domain.com/',
headers: {
Authorization: 'Bearer TOKEN',
},
}}
controls
offline
watermark={{
text: 'USER123',
dynamic: true,
interval: 20,
}}
/>
);
}Android Setup
The Android implementation is written in Kotlin and uses Media3:
media3-exoplayer,media3-exoplayer-dash,media3-exoplayer-hlsDefaultDrmSessionManager,HttpMediaDrmCallback,OfflineLicenseHelperDownloadServicefor foreground offline downloadsMediaSessionfor Android TV, lock screen controls, headset controls, and background integrationFLAG_SECURE, root checks, and emulator checks for secure playback
Minimum supported SDK is API 23. Host apps should compile with Android SDK 35 or newer.
If your app has a custom manifest, keep these permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />iOS Setup
The iOS implementation is written in Swift and uses:
AVPlayer,AVPlayerLayer, andAVFoundationAVAssetResourceLoaderDelegatefor FairPlay license requestsAVAssetDownloadURLSessionfor offline asset downloads- AirPlay and Picture in Picture through system AVKit APIs
- screen recording detection and jailbreak checks
iOS 13 or newer is required. The podspec links AVFoundation, MediaPlayer, and UIKit.
DRM Setup
Widevine
drm={{
type: 'widevine',
licenseUrl: 'https://license.domain.com/widevine',
headers: {
Authorization: `Bearer ${jwt}`,
'X-Device-ID': deviceId,
},
jwt,
tokenRefreshUrl: 'https://api.domain.com/playback/token',
tokenRefreshInterval: 900,
offlineLicense: true,
deviceBinding: true,
}}Android supports Widevine L1/L3 depending on device capabilities and license policy. Your license server controls entitlement, robustness rules, key duration, renewal, and HDCP restrictions.
FairPlay
drm={{
type: 'fairplay',
certificateUrl: 'https://license.domain.com/fps.cer',
licenseUrl: 'https://license.domain.com/fairplay',
contentId: 'movie-123',
headers: {
Authorization: `Bearer ${jwt}`,
},
offlineLicense: true,
}}FairPlay requires an Apple FPS certificate, an SPC-to-CKC license endpoint, and backend-specific content ID handling. The native ArchAngPaulFairPlayManager is the integration point for that exchange.
Offline Example
const download = await ArchAngDownloader.download({
id: 'movie-123',
source: {
uri: 'https://domain.com/movie.mpd',
type: 'dash',
},
drm: {
type: 'widevine',
licenseUrl: 'https://license.domain.com/widevine',
headers: { Authorization: 'Bearer TOKEN' },
offlineLicense: true,
},
quality: '1080p-60',
title: 'Movie 123',
});
ArchAngDownloader.addProgressListener((event) => {
console.log(event.id, event.state, event.progress);
});
await ArchAngDownloader.pause('movie-123');
await ArchAngDownloader.resume('movie-123');
await ArchAngDownloader.delete('movie-123');Custom Controls Example
const player = useRef<ArchAngPlayerControls>(null);
<ArchAngPaulPlayer ref={player} source={source} controls={false} />;
<Button title="Play" onPress={() => player.current?.play()} />;
<Button title="+10" onPress={() => player.current?.forward(10)} />;
<Button title="PiP" onPress={() => player.current?.enterPictureInPicture()} />;API Documentation
ArchAngPaulPlayer
Important props:
source:{ uri, type }wheretypeisdash,hls,mp4,live, orvoddrm: Widevine, FairPlay, or multi-DRM license configurationcontrols: enables built-in controlsoffline: enables offline-aware playbackwatermark: text, user ID, email, mobile, dynamic movement, opacity, and custom stylesecureSurface: enables screenshot and screen recording protections where the OS allowsallowCasting: enables Chromecast, Android TV, AirPlay, and Apple TV pathwaysallowPictureInPicture: enables PiP on supported OS versions
Imperative methods:
play,pause,stop,replay,seekforward,backwardfullscreen,minimize,lockControlssetQuality,setAudioTrack,setSubtitleTrack,setSubtitleStylesetPlaybackSpeed,enterPictureInPicture,getAnalytics
Events:
onLoad,onPlay,onPause,onEnd,onErroronBuffer,onSeek,onProgressonQualityChange,onAudioChange,onSubtitleChangeonDRMError,onDownloadProgress
ArchAngDownloader
Promise methods:
download(request)pause(id)resume(id)cancel(id)delete(id)get(id)list()storageUsage()addProgressListener(listener)
Supported Quality Labels
- Auto
- 8K
- 4K 120fps, 4K 60fps, 4K 30fps
- 1080p 120fps, 1080p 60fps, 1080p 30fps
- 720p, 480p, 360p, 240p
Security Notes
Android uses FLAG_SECURE, root detection, emulator detection, Widevine robustness, and Media3 DRM callbacks. iOS detects screen capture and jailbreak indicators. These checks harden playback, but DRM security ultimately depends on license policy, device trust, backend entitlement checks, and key lifetime.
Development
npm install
npm run typecheck
npm test
npm run buildThe example app lives in example/.
