| Crates.io | unified-headless-video-core |
| lib.rs | unified-headless-video-core |
| version | 0.3.0 |
| created_at | 2026-01-25 15:14:31.979546+00 |
| updated_at | 2026-01-25 15:14:31.979546+00 |
| description | Cross-platform headless video playback logic engine - Same code, same behavior, all platforms |
| homepage | https://github.com/4iShmmri/unified-headless-video-core |
| repository | https://github.com/4iShmmri/unified-headless-video-core |
| max_upload_size | |
| id | 2068931 |
| size | 525,462 |
Cross-platform video playback logic engine - Same code, same behavior, all platforms.
A Rust library that manages video playback logic (state management, quality decisions, events) without performing video decoding or rendering. It works seamlessly with native video players on each platform (ExoPlayer on Android, AVPlayer on iOS, video_player on Flutter, react-native-video on React Native, HTML5 Video on Web).
Core Principle: Core makes decisions โ Platform adapters execute them.
Traditional video playback solutions require maintaining separate codebases for each platform, leading to:
Unified Headless Video Playback Core solves this by providing:
โก Fast Install? See QUICK_INSTALL.md for one-command installation on any platform.
For development or unpublished versions, install from Git:
[dependencies]
unified-headless-video-core = { git = "https://github.com/4iShmmri/unified-headless-video-core", tag = "v0.3.0" }
Or use the latest commit:
[dependencies]
unified-headless-video-core = { git = "https://github.com/4iShmmri/unified-headless-video-core" }
Install directly from crates.io:
[dependencies]
unified-headless-video-core = "0.3.0"
Or use the latest version:
[dependencies]
unified-headless-video-core = "0.3"
Clone the repository and add as a local dependency:
git clone https://github.com/4iShmmri/unified-headless-video-core.git
cd unified-headless-video-core
Then in your Cargo.toml:
[dependencies]
unified-headless-video-core = { path = "../unified-headless-video-core" }
For platform-specific integrations (Android, iOS, Flutter, React Native, Web), see:
use core::core::*;
fn main() -> Result<()> {
// Create player
let mut player = CorePlayer::new(Config::default())?;
// Load video
player.load("https://example.com/video.mp4")?;
// Play
player.play()?;
// Control playback
player.set_speed(1.5)?; // 1.5x speed
player.seek(30.0)?; // Seek to 30 seconds
// Handle events
player.on_event(Box::new(|event| {
match event {
Event::Play => println!("Playing"),
Event::QualityChanged(q) => println!("Quality: {}", q),
Event::Error(msg) => eprintln!("Error: {}", msg),
_ => {}
}
}));
Ok(())
}
See platform-specific documentation:
Android (ExoPlayer):
// Different code for each platform
val exoPlayer = ExoPlayer.Builder(context).build()
exoPlayer.setMediaItem(MediaItem.fromUri(url))
exoPlayer.prepare()
exoPlayer.play()
// Different ABR logic
// Different state management
// Different event handling
iOS (AVPlayer):
// Completely different code
let player = AVPlayer(url: URL(string: url)!)
player.play()
// Different ABR logic
// Different state management
// Different event handling
Problems:
All Platforms:
// Same code everywhere!
let mut player = CorePlayer::new(Config::default())?;
player.load(url)?;
player.play()?;
// Same ABR logic everywhere
// Same state management everywhere
// Same event handling everywhere
Benefits:
| Feature | Without Core | With Core |
|---|---|---|
| Code Consistency | โ Different code per platform | โ Same code everywhere |
| Behavior | โ Inconsistent | โ Identical |
| Bug Fixes | โ Fix 5+ times | โ Fix once |
| ABR Logic | โ Platform-specific | โ Unified |
| State Management | โ Platform-specific | โ Unified |
| Maintenance | โ High (5x effort) | โ Low (1x effort) |
| Testing | โ Test 5+ platforms | โ Test Core once |
See the examples directory for complete examples:
basic_usage.rs - Basic playbackwebm_example.rs - WebM format with enhanced metadatamkv_example.rs - MKV format with subtitle supportflv_example.rs - FLV format with metadata extractionrtmp_example.rs - RTMP streamingrtsp_example.rs - RTSP streamingsmooth_streaming_example.rs - Smooth Streaming with fragment URLsadvanced_usage.rs - Advanced featuresThe project includes comprehensive testing:
Run tests:
cargo test
cargo test -- --ignored # Run stress tests
cargo bench # Run benchmarks
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Application Layer โ
โ (Your App: Android/iOS/Flutter/React Native/Web) โ
โโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Platform Adapter Layer โ
โ (Thin Wrappers: Kotlin/Swift/Dart/TypeScript/WASM) โ
โโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FFI Bridge Layer โ
โ (C API / WASM API) โ
โโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Rust Core Layer โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ State Machineโ โ ABR Engine โ โ Parsers โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ Event System โ โ Plugin Systemโ โ DRM Handler โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Native Player Layer โ
โ (ExoPlayer / AVPlayer / video_player / HTML5 Video) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
cargo build # Debug build
cargo build --release # Release build
cargo test # Run tests
cargo fmt # Format code
cargo clippy # Lint code
See platform-specific READMEs for build instructions:
Status: โ
Production Ready
Version: 0.2.0
Test Coverage: 52+ tests
Licensed under either of:
at your option.
Contributions are welcome! Please see our contributing guidelines.
Built with โค๏ธ using Rust