BufferedTV started life as a PeerTube app for Apple TV. It's since grown iPhone, iPad and Android versions, and this month it arrived on the Linux desktop. Version 1.1.1 has just shipped, so here's how it's put together and a few things I learnt on the way.
What PeerTube is, and what the app does
PeerTube is thousands of small video sites (instances) that share videos with each other over ActivityPub. BufferedTV lets you sign in to one, then searches the whole network, plays from wherever a video is hosted, keeps your subscriptions and watch progress in step with your instance, and downloads videos with their subtitles for later.
The stack
- Rust 2024, with gtk4-rs and libadwaita for the interface- GStreamer through GstPlay, drawing into a gtk4paintablesink- tokio and reqwest for the PeerTube API, OAuth with one-time passwords included- oo7 for the Secret Service, so tokens live in your keyring- mpris-server, so media keys and desktop media controls work- Flatpak on the GNOME runtime, built for amd64 and arm64 in Forgejo Actions## tokio beside the GTK main loop GTK widgets live on one thread, and network calls shouldn't block it. The app runs a tokio runtime next to the GTK main loop, and a small spawn helper runs a future on tokio, then hands the result back to the main loop with glib::spawn_future_local. The UI code reads like ordinary callbacks, and nothing touches a widget from the wrong thread. ## Playback PeerTube serves HLS, often with audio split from video. GstPlay plays the HLS master playlist with a height cap chosen from the quality menu, and the frames go to gtk4paintablesink (wrapped in glsinkbin when there's a GL context), so video is just another GTK widget. Subtitles are drawn as a label over the picture, which keeps them consistent with the app's own styling. ## Two bugs worth knowing about Synthetic motion events. In full screen, the controls should hide after a few seconds without mouse movement. They kept reappearing. GTK sends a motion event whenever the layout changes under a still pointer, and hiding the controls changes the layout. Now the controls only come back when the pointer has really moved more than a couple of pixels. Comments arrive in two formats. PeerTube's own comments are Markdown, but comments from Mastodon and the wider fediverse arrive as HTML. Rendering both as Markdown showed the raw tags, so the app now detects HTML and converts it to Pango markup itself, with only http(s) links and a small set of safe tags allowed through. ## A tight Flatpak The Flatpak asks for network, display, sound and GPU access, plus its own MPRIS name, and nothing else: no access to your files. Downloads live in the app's own data folder. Every build runs a smoke test inside the sandbox to check the GStreamer plugins it needs are there. ## New in 1.1.1
- Picture in picture: press P and the video moves to its own small window- A sidebar that folds down to its icons (F9), remembered between launches- Fediverse comments displayed properly- Full-screen controls that hide again- A like count that updates as you press Like## Try it Download the Flatpak from https://buffered.tv/linux. The source is MIT licensed at https://code.squarecows.com/ric/bufferedtv-linux, and issues and pull requests are welcome.
Top comments (1)
GTK firing a motion event after you hide the fullscreen controls is an evil loop. Drawing subtitles as a label over gtk4paintablesink also sounds cleaner than fighting Gst overlays. Any tearing on Wayland with glsinkbin, or has that been solid?