Files
buzz/mobile/lib/features/channels/message_content
Tom Brow 85c7156085 perf(mobile): stop downloading whole videos for posterless stills (#9367)
Follow-up to [#9356 gallery video
selection](https://github.com/block/buzz/pull/9356), merged as
[ef57fec4d](ef57fec4d2).
It makes two changes that came out of review.

### 1. Remove automatic stills for videos without poster metadata

#9356 generated a still for every rendered video bubble or stack card
that had no NIP-71 poster. To do that it downloaded the **whole video**
(up to the 100 MB limit), grabbed a frame and threw the file away.
Desktop (buzz-app) never writes `image`/`thumb` on video attachments, so
this covered every desktop-sent video, not only old mobile messages.
Before #9356 those bubbles were a static placeholder that used no
network.

The cost on a real timeline:
- A four-card stack could pull up to about 400 MB just for stills,
before anyone pressed play.
- When the user did open a video, playback started its own separate
download of the same file, and the poster download kept competing for
bandwidth.
- A failed, cancelled or stalled download saved nothing, so every
remount (scroll back, swipe back in a stack) started the full GET again.
Cached stills from non-relay URLs were also dropped and fetched again
after the cache's seven-day expiry.

This PR deletes that path: `video_poster.dart` and its test, plus the
watchers and `generatedPoster` branches in `video_preview.dart` and
`media_stack.dart`. Posterless videos are back to base behavior: "Video
attachment" in a bubble, the plain surface on a stack card, and the
source snapshot in the native viewer. The rest of #9356 stays: queued
local stills (`prepareVideoPoster` on the local file, no network), the
remote-poster preview in the native viewer, the picker changes and swipe
dismissal.

`NativeVideoFiles._cancelTimeouts` was added for poster disposal. No
remaining test depends on it, so it goes back to base too.

If stills for desktop-sent videos are still wanted, a bounded follow-up
is to generate and cache the still from the file that playback already
downloaded, after the user opens it. That adds no network.


### 2. Route `.3gpp` and `.3g2` picks as videos

The Video row is gone from the attachment menu, so `_isPickedVideo` is
now the only thing that classifies path-only picker results. Its
extension list missed `3gpp` and `3g2`. The recent-media grid returns
the original library file, and PHPicker exports 3GPP2 as `.3g2`, so
those videos were queued as images and then rejected by `uploadImage`.
Before #9356, the explicit Video action uploaded them through
`uploadVideo`, which transcodes to MP4.

### Pareto

The change only removes work: no extra network or decoding for
posterless videos, and no change for videos that carry a poster. The one
thing we give up is the still on posterless videos that #9356 added and
base never had.

### Validation

- Added test rows: `clip.3gpp` and `clip.3g2` in the existing
mixed-gallery composer journey. Both now queue as video.
- Full mobile `flutter test` passes on
[518af3a0d](518af3a0d2):
4,688 passed, 71 skipped. `flutter analyze` is clean.
- I didn't run an app journey for this fix. It brings the posterless
paths back to base code, and #9356's own validation covers the rest.

Review report:
`buzz://message?channel=e71f9a2a-ac46-473d-a24e-5e16fd8cb7b1&id=bcae52d59c255add1a927e0135441a1c58115b6aa6cda8d9ff7e58d47a627a87`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 03:18:29 +00:00
..