Minimalistic API to play Youtube videos
youtubeVideo = require('youtube-video')
youtubeVideo('sl1Q6W0UzGk', {
elementId: 'foobar',
width: 640,
height: 390,
autoplay: true,
controls: false,
onPlay: onPlay,
onEnd: onEnd,
onPause: onPause
}, (error, playback) => { playback.playVideo() })
- Demo: http://requirebin.com/embed?gist=6774318
- Source code: http://requirebin.com/?gist=6774318
$ npm install youtube-video
youtubeVideo('https://www.youtube.com/watch?v=rfh4Mhp-a6U', function (error, playback) {
playback.playVideo()
})
youtubeVideo = require('youtube-video')
youtubeVideo('sl1Q6W0UzGk', {
elementId: 'player', // by default: youtube-video
width: 640,
height: 390,
autoplay: true,
controls: false,
onPause: onPause,
onPlay: onPlay,
onEnd: onEnd
}, (error, playback) => { playback.playVideo() })