This feature is still in the final beta round. To request access as a beta tester, send an email to offlinemode@despia.com
Installation
- Bundle
- CDN
API Reference
Write
Download and cache a remote file. Fire-and-forget - do not await.- Basic
- With Push
string
required
Remote file URL to download
string
required
Local path:
folder/subfolder/filenamestring
required
Unique ID for this file
boolean
Set to
true to show push notification on completionstring
Notification message (wrap in quotes)
Read
Get metadata for specific cached files by ID.array
Array of cached file objects
Response Example
Response Example
Polling Pattern
Polling Pattern
Query
Return all cached files. Use this to get a full inventory without specifying individual IDs.array
Array of all cached file objects across all folders
Response Example
Response Example
localcdn://query returns every item in the cache. To fetch specific files by ID, use localcdn://read instead.Delete
Remove cached files.contentServerChange callback
Called by the native runtime when a download completes. This is where you get the file data.Callback Payload
Callback Payload
Response schema
string
Full file path (e.g.,
videos/samples/bigbunny.mp4)string
Your unique identifier
string
File extension (
mp4, mp3, json)string
Absolute device path
string
Use this for playback - localhost URL
string
Original remote URL
string
File size in bytes
string
Cache status (
"cached")string
Unix timestamp
Background downloads
Downloads continue when users close the app. The native OS handles retry on network failure. On iOS, a Live Activity is shown automatically with real-time download progress. On Android, a native download progress notification appears in the system tray. Both require no setup. When the app reopens, the native layer finds any pending items and callscontentServerChange(item) for each completed download automatically.
Playback
Use thelocal_cdn URL for offline playback:
HTTP upload API
Only available when your app is served via Despia Local Server (not from origin/remote server).
React hook
Environment check
Test videos
Free sample videos for testing Local CDN (CC licensed):Available test videos
Available test videos
Quick test script
Quick test script
Resources
NPM Package
despia-native