SRGSSR / pillarbox-apple

A next-generation reactive media playback ecosystem for Apple platforms.
https://testflight.apple.com/join/TS6ngLqf
MIT License
43 stars 6 forks source link

Load images lazily #859

Closed defagos closed 3 days ago

defagos commented 2 weeks ago

As a developer integrating Pillarbox I don't want images to be unnecessarily loaded if not used, e.g. if no chapters are displayed in my custom user interface.

Acceptance criteria

Tasks

defagos commented 1 week ago

AVMetadataItem, even though its API seems to support lazy loading, calls its value loading handler in a not-so-lazy way. Even if a metadata item, assigned to the externalMetadata of an AVPlayerItem, is not used in any way (e.g. no AVPlayerViewController is used), the handler will namely be called.

For this reason it appears we cannot really lazily load the main artwork image associated with an item, as it needs to be stored in its externalMetadata. For this reason it is also not useful to lazily load the artwork in the now playing info.