| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
fix: video thumbnail loading (#3584) ## 🎯 Goal This PR fixes video thumbnail loading logic so that it is consistent across video thumbnails and image attachments. Additionally, it: - Improves performance on Android by reducing the number of moving parts in the shimmering layer (same as we did for iOS) - Introduces an orchestrator so that each shimmering view doesn't create its own `ValueAnimator` unnecessarily - Makes sure offscreen views are not animating (they still stay registered though unless they actually unmount/detach) - Fixes offline images with the new `FastImage` library in the sample app ## 🛠 Implementation details <!-- Provide a description of the implementation --> ## 🎨 UI Changes <!-- Add relevant screenshots --> <details> <summary>iOS</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> <details> <summary>Android</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> ## 🧪 Testing <!-- Explain how this change can be tested (or why it can't be tested) --> ## ☑️ Checklist - [ ] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (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 | 3 个月前 | |
fix: missing poster image bailing on thumbnails (#3754) ## 🎯 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 <details> <summary>iOS</summary> </details> <details> <summary>Android</summary> No Android changes. </details> ## 🧪 Testing <!-- Explain how this change can be tested (or why it can't be tested) --> ## ☑️ Checklist - [ ] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (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 | 30 天前 |