Building a Telegram video player for Android TV, phones and desktop with Kotlin, TDLib and Compose
说明与用途
TMPlayer 是一个跨平台的 Telegram 视频播放器,直接从聊天中流式播放,支持 Android TV、手机和桌面。它使用 TDLib 进行身份验证和文件访问,使用 ExoPlayer 进行播放,并通过 GitHub Actions 自动化发布构建。
问题
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.
结果
TMPlayer delivers a cross‑platform Telegram video player that streams directly from Telegram chats, supports low‑resource devices, and automates release publishing.
工作流
- 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.
证据
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.
- 记录日期: 2026-10-20T05:56:21.877Z