DEV Community

hammi
hammi

Posted on

why i skipped exoplayer and bet on the system mediaplayer for a 1.17 mb player

i'm the developer of rkmovies — a 4k media player that ships as grab the apk here (1.17 mb) and install it on windows (29.5 mb), with the web app at this thing i'm building. when i started, every android video tutorial pointed at media3/exoplayer. i went the other way: the app bundles zero media libraries and plays through the webview's <video> element, which hands decoding to the device's mediacodec. here's the math that decided it.

the size tax. media3/exoplayer costs roughly 1–3 mb of apk depending on which modules you pull in, before any software decoder extensions — that's google's own estimate, and r8 shrinking gets maybe 40% of it back for a typical player. for an app whose whole point is running on a 2 gb budget phone on a 1.5 gb/day data plan, 1–3 mb is 100–250% of my entire binary.

what the megabytes buy. consistent behavior across devices, dash + hls adaptive streaming out of the box, swappable renderers, gapless playlists. real stuff. what the system mediaplayer costs you: behavior shifts across oem roms, hls support varies by android version, and you can't patch a decoder bug on a user's phone — you wait for the os update or you route around it.

my workaround. feature-detect at runtime and keep a fallback chain. if video.canPlayType('application/vnd.apple.mpegurl') says maybe, i still try hls — most android 8+ webviews handle it through the system player. where a rom chokes, i fall back to the best mp4 the source offers. every step is a try/catch because webviews throw different errors instead of returning undefined. i learned that on a budget micromax device.

the general pattern i've landed on: features don't cost size, dependencies do. the gesture hud, multi-audio track switching (hindi/tamil/telugu/english), webvtt subtitles, picture-in-picture — all of it is js calling apis the platform already exposes. zero bytes of apk.

if you're building something small: start with what the os gives you. add a library only when you hit a wall the platform can't solve, and measure the wall before you buy the ladder.

Top comments (5)

Collapse
 
alexcodebytes profile image
Oleksandr •

"Features don't cost size, dependencies do" is such a solid rule of thumb. Skipping ExoPlayer is a bold move, but saving 1–3 MB on a 1.17 MB app is literally everything. Dealing with OEM ROM inconsistencies via feature detection and try/catch is a pain, but it's definitely the right call over bundling heavy libraries.

Collapse
 
hammiwor profile image
hammi •

exactly, on a 1.17 mb app every mb is a feature decision. exoplayer alone would have tripled the size

Collapse
 
alexcodebytes profile image
Oleksandr •

Tripling the size for something the system already does for free is the definition of a bad trade. At 1.17 MB the size isn't a constraint — it's the whole design.

Thread Thread
 
hammiwor profile image
hammi •

good point on Tripling the size for something the syst. i measured something similar on my own build and it changed how i think about startup work

Thread Thread
 
alexcodebytes profile image
Oleksandr •

Measuring is the ultimate reality check. Once you see how much a single library like ExoPlayer adds to your app size and cold start time, it completely changes how you approach dependency management. "Do I really need this, or can the system handle it?" becomes your first question. Glad the post resonated with you!