Under the Hood

A deep dive into the engineering decisions and architecture that power RandomPlayer.

Tech Stack

Language
Swift 6
Strict concurrency, async/await
UI Framework
SwiftUI
Declarative, platform-native
Playback
AVFoundation
Hardware-accelerated video
Networking
SwiftNIO
HTTP proxy server
Protocol
AMSMB2
SMB/CIFS client
Sync
CloudKit
iCloud watch history
Container
MKV Remuxer
Pure Swift MKV/WebM → MP4

Engineering Highlights

Zero External JavaScript

The entire app is native Swift. No web views, no Electron, no cross-platform compromises. Each platform gets purpose-built UI.

HTTP Proxy Architecture

A SwiftNIO-based local HTTP server enables seamless streaming with full range request support. This allows AVPlayer to work with SMB sources as if they were native HTTP streams.

Actor-Isolated Concurrency

Swift 6 strict concurrency throughout. Actors manage shared state, eliminating data races while maintaining responsive UI during heavy I/O operations.

Sparse File Caching

Intelligent caching that only downloads the bytes you actually watch. Seek to the middle of a 10GB file? Only that portion gets cached.

On-the-Fly MKV Remuxing

A pure Swift MKV/WebM parser repackages video into MP4 containers in real time. Handles B-frame reordering, FLAC audio, and multi-track files with zero quality loss—no FFmpeg or external dependencies required.

Interested in the source? This is a personal project, but feel free to reach out.