Building a Telegram video player for Android TV, phones and desktop with Kotlin, TDLib and Compose
Description and use
TMPlayer is a cross‑platform Telegram video player that streams directly from chats on Android TV, phones, and desktops. It uses TDLib for authentication and file access, ExoPlayer for playback, and automates release builds via GitHub Actions.
Problem
Users want to watch Telegram videos directly on TVs without casting from a phone, which ties up the phone and stops playback when the phone sleeps.
Outcome
TMPlayer delivers a cross‑platform Telegram video player that streams directly from Telegram chats, supports low‑resource devices, and automates release publishing.
Workflow
- 1. User scans QR code with phone to authenticate on TV.
- 2. TV app retrieves chat list via TDLib.
- 3. User selects a chat; only playable videos are displayed as a library.
- 4. User selects a video; TMPlayer streams it using ExoPlayer with a custom DataSource that requests byte ranges from TDLib.
- 5. Playback starts as soon as enough data is available; seeking requests specific byte ranges.
- 6. On low‑RAM devices, heavy features are disabled automatically.
- 7. Optional artwork and overviews are fetched from TMDB, TVmaze, or AniList if enabled.
- 8. Releases are built and distributed via a single GitHub Actions workflow that publishes APK, MSI, DMG, and AppImage, updates changelog, posts to Telegram channel, and pings search engines.
Evidence
TMPlayer is my attempt at the TV side of that. It is a free, open source (GPL-3.0-or-later) player for the videos already in your own Telegram chats.
The app has no server of its own. The TV talks to Telegram directly, under the user's own account, and the app shows nothing the user's account could not already see.
On Android the player is Media3's ExoPlayer, and TMPlayer gives it a custom DataSource that maps ExoPlayer's reads onto TDLib's offset based partial downloads.
The reference device is a cheap Android TV stick with 1 GB of RAM and 8 GB of storage. That decision shaped a lot: The app keeps one video in its watch cache at a time instead of filling the disk.
One GitHub Actions workflow builds the Android APK, the Windows MSI, the macOS DMG and the Linux AppImage and tarball from a tag.
- Record date: 2026-10-20T05:56:21.877Z