(WIP) feat: Allow picture sources to be set on poster #8052
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Now that the PosterImage uses a poster, we can make use of it to support multiple image formats. Very much a work in progress, needs tests, and there may well be edge cases yet to be considered.
Changes:
poster()
setter may now be a poster options object. A string is still supported to be non-breaking.sources
. The object properties will be used as attributes of<source>
elements of thePosterImage
's<picture>
.img
, which is thesrc
used for the<picture>
's<img>
. Ifsources
is set andimg
is not,img
is set to the last item insources
.alt
, so alt text can be set on the<img>
.posterOptions
.posterOpts()
getter to fetch the poster options. However this is not a setter, since the options are set withposter()
.poster()
as a getter will return the image actually used.noTechPoster
is set to true. This is useful since the poster now uses laszy loading, so the video el doesn't load the image.Examples
To do