YouTube embed poster frame widget
A widget to allow smooth transition between poster frame, YouTube video and back.
- Expands to fit any container with correct aspect ratio (16:9 and 4:3 variations).
- Fully responsive on small screens.
- Not using the Youtube js API (only because it's another http call and we'd use barely any of it)
- Smooth transition between poster and video
- Poster frame doesn't need any "play button" images embedded in, they're CSS elements that part of the widget, so are retina res, easily coloured and have a hover state transition.
- videoStop() script, useful for buttons or javascript events (eg closing modals), that removes the src of the youtube video, preventing it from playing after it's hidden. Can be targeted at a particular video, or all on the page.
- Delegated click event, allowing the video element to be ajaxed in after page initilisation, and still work.
- Keyboard accessible (and a focus state to show when you've correctly selected it)