From #33 review feedback. User asked: 'If user clicks play while in collapsed state, could it also auto-expand to the expanded state when it starts playing?' Acknowledged 'acceptable as is' if hard.
Why deferred: Cross-origin iframes (YouTube, Vimeo) don't surface play events to the parent document. Detecting a play click on the embedded player requires:
- YouTube IFrame Player API — append
?enablejsapi=1 to embed URL, load YouTube's iframe_api JS, instantiate a YT.Player on the iframe element, listen to onStateChange events for state === YT.PlayerState.PLAYING.
- Vimeo Player JS API — load player.js library, instantiate a Vimeo Player on the iframe, listen to 'play' event.
Both require runtime JS overhead (the YouTube/Vimeo libraries) and a per-provider dispatch. Worth doing if it becomes a recurring usability gap; not blocking launch.
When triggered: card auto-expands (set isExpanded = true). Already-rendered iframe continues playing through the expansion (or restarts with autoplay=1 in expanded src).
Trigger to revisit: post-launch, if user testing surfaces a real friction point at the play-in-collapsed step.
From #33 review feedback. User asked: 'If user clicks play while in collapsed state, could it also auto-expand to the expanded state when it starts playing?' Acknowledged 'acceptable as is' if hard.
Why deferred: Cross-origin iframes (YouTube, Vimeo) don't surface play events to the parent document. Detecting a play click on the embedded player requires:
?enablejsapi=1to embed URL, load YouTube's iframe_api JS, instantiate a YT.Player on the iframe element, listen to onStateChange events for state === YT.PlayerState.PLAYING.Both require runtime JS overhead (the YouTube/Vimeo libraries) and a per-provider dispatch. Worth doing if it becomes a recurring usability gap; not blocking launch.
When triggered: card auto-expands (set isExpanded = true). Already-rendered iframe continues playing through the expansion (or restarts with autoplay=1 in expanded src).
Trigger to revisit: post-launch, if user testing surfaces a real friction point at the play-in-collapsed step.