3.8.0 • Published 9 years ago

deku-youtube-video v3.8.0

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

deku-youtube-video

Youtube video component for deku.

Usage

npm install deku-youtube-video
import YoutubeVideo from 'deku-youtube-video';

const onClick = (e, component, setState) => {
  console.log('video clicked');
  // Set state.opened to true to play the video
  setState({ opened: true });
}

export default {
  render: function ({ state }) {
    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 on
  • opened=[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 to hqdefault

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.ENDED
  • onPlaying - called on window.YT.PlayState.PLAYING
  • onPaused - called on window.YT.PlayState.PAUSED
  • onBuffering - called on window.YT.PlayerState.BUFFERING
  • onCued - called on window.YT.PlayerState.CUED

index.css

Import the css using postcss.

@import 'deku-youtube-video';
3.8.0

9 years ago

3.7.0

9 years ago

3.6.0

9 years ago

3.5.0

9 years ago

3.4.0

9 years ago

3.3.0

9 years ago

3.2.0

9 years ago

3.1.0

10 years ago

3.0.0

10 years ago

2.0.0

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago