deku-youtube-video
Youtube video component for deku.
Usage
npm install deku-youtube-video
; const onClick = { console; // Set state.opened to true to play the video ;} { const opened = state; return <YoutubeVideo youtube-id='YoB8t0B4jx4' onClick=onClick opened=opened />; }
Attributes
youtubeId=[youtube-video-id]
Set youtube video ID to use.onClick=[function]
Function to run when video is clicked onopened=[boolean]
If false, shows a video preview using the youtube thumbnail and if true opens and plays the video.thumbnail=[string]
- Optional Set custom thumbnail image, this will override the standard youtube thumbnail.thumbnailSize=[string]
- Optional Set which youtube thumbnail to use, defaults tohqdefault
events
If you load the youtube iframe api (https://www.youtube.com/iframe_api
), support for the following events exists (as attributes):
onEnded
- called on window.YT.PlayState.ENDEDonPlaying
- called on window.YT.PlayState.PLAYINGonPaused
- called on window.YT.PlayState.PAUSEDonBuffering
- called on window.YT.PlayerState.BUFFERINGonCued
- called on window.YT.PlayerState.CUED
index.css
Import the css using postcss.
;