Skip to content

fix: missing poster image bailing on thumbnails - #3754

Merged
isekovanic merged 3 commits into
developfrom
fix/missing-poster-image-bailing-on-thumbnails
Aug 5, 2026
Merged

fix: missing poster image bailing on thumbnails#3754
isekovanic merged 3 commits into
developfrom
fix/missing-poster-image-bailing-on-thumbnails

Conversation

@isekovanic

Copy link
Copy Markdown
Contributor

🎯 Goal

For some reason, it would appear that video attachments picked from the photo library show no thumbnail when PhotoKit had no cached poster frame for the asset, so the image request fails with PHPhotosErrorDomain 3303 and generation bails. Hits uncached/freshly imported library videos on devic, and always hits videos added to a Simulator via simctl addmedia as an example (which won't immediately generate poster images unless you open the Photos app for example).

πŸ›  Implementation details

iOS StreamVideoThumbnailGenerator:

  • Switched the PhotoKit request from .fastFormat to .highQualityFormat. .fastFormat only returns an already cached rendition and won't generate one on demand (contrary to my previous belief), so uncached assets come back empty. .highQualityFormat renders the poster on demand at the requested targetSize, so still only the poster frame and not the whole video
  • Lowered maxDimension from 512 to 256. .highQualityFormat honors targetSize (unlike .fastFormat, which ignores it and always returns a fixed ~120px from my tests), so 256px is crisp at the picker cell for ~1/4 the decoded RAM. Android intentionally stays at 512 as its getScaledFrameAtTime scaler is cruder and needs more source pixels (documented in a code comment)

Reducing the size of the generated tuhmbnails is considered safe as this was anyway happening with .fastFormat (as mentioned it appears to simply return smaller images rather than play around with downscaling specifically). If anything, it's an increase in quality as from my benchmarks it showed that loading ~200 video thumbnails all at the same time (this is a very pessimistic test of course) rounds out to about ~20MB of extra ram usage. And this is even before taking image optimizations into account, which would alleviate decoding cycles as well. So the quality should be much better while paying almost nothing. So in essence we're basically trying to mimic what .fastFormat does itself but with some extra exploration around it.

🎨 UI Changes

iOS
Android

No Android changes.

πŸ§ͺ Testing

β˜‘οΈ Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • Documentation is updated
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

@Stream-SDK-Bot

Copy link
Copy Markdown
Contributor

SDK Size

title develop branch diff status
js_bundle_size 1990 KB 1990 KB 0 B 🟒

@isekovanic
isekovanic merged commit e1b8966 into develop Aug 5, 2026
10 checks passed
@isekovanic
isekovanic deleted the fix/missing-poster-image-bailing-on-thumbnails branch August 5, 2026 14:34
@github-actions github-actions Bot mentioned this pull request Aug 6, 2026
6 tasks
@stream-ci-bot

Copy link
Copy Markdown
Contributor

πŸŽ‰ This PR is included in version 9.7.3 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants