YouTube Wrapper
A simpler way to load YouTube players.
For use with Browserify
Install
npm i youtube-wrapper
Use
var youTube = ; // Call this **once** in our app to automatically load the YouTube APIyouTube; // -- OR -- // Load it yourself and call (usually in window.onYouTubeIframeAPIReady):youTube; // Anyway, you can immediately do :var Player = youTubePlayer;var player = element opts;// element and opts are the same as in the YouTube API player; // No need to wait for the onReady event !
NB :
opts
doesn't accept the events
key. Instead Player
inherits from Node's EventEmitter
.
Available events and methods are listed in youTube.PROXIED_YT_EVENTS
and youTube.PROXIED_YT_METHODS
.
If YouTube adds some events before an update of this module you can add them to youTube.PROXIED_YT_EVENTS
.
If YouTube adds some methods before an update of this module you can add them with youTube.proxyYTMethod('methodName')
.
Or you can use player.applyYTMethod('methodName', [args])
License
MIT