-
Notifications
You must be signed in to change notification settings - Fork 54
Adding loading state to psammead-media-player #3600
Conversation
packages/components/psammead-media-player/src/Canonical/index.jsx
Outdated
Show resolved
Hide resolved
…to loading-placeholder-MAPs
[ARCHIVE - Explanation of the approach taken] Broadly speaking, there are two approaches for adding a loading placeholder while only accessing the outer iframe
Approach 1:A. Using onLoad to conditionally render the component, without animation
B. Using onLoad, plus animation ✨ 😮
Approach 2 (I'd advocate for this ✅ ):Use z-index to place media player on top of loading placeholder - once it's loaded, the placeholder is masked.
|
Resolves #bbc/simorgh#7185
Overall change:
Part 3/3 to resolve #7185
The final PR to add a dark-mode compatible image placeholder to the
psammead-media-player
.1. Add dark mode version of BBC_BLOCKS . #36102. Implement dark mode forpsammead-image-placeholder
. #36113. Implement image placeholder in
psammead-media-player
. (this one)Overall change:
AmpImg
directly below the parentamp-iframe
. It uses the media's thumbnail as the image, and has a small loading animation while the media initialises. Once it is initialised, the placeholder is given thevisibility: hidden
property. Documentation of this is available here https://amp.dev/documentation/guides-and-tutorials/develop/style_and_layout/placeholders/?format=websites & the code is here