Takes advantage of Youtube Iframe api to ease make use of it.
First you need to create an instance of MooTube, which loads the Youtube Iframe API. var mootube = new MooTube({ onReady: function() { // Youtube Iframe API is ready to go! } }); Once the API is loaded and ready, you can create players on any element in the DOM. var player = mootube.player('player', { video_id: 'OuoytdFfyXs', width: 800, height: 600, playerVars: { autoplay: 1, theme: 'light' }, // onReady EVENT onReady: function() { // Video player is ready to listen calls } }); You can see the complete list of player variables to place in 'playerVars' option at: https://developers.google.com/youtube/player_parameters?playerVersion=HTML5
Every player has the same functions than API, since these are mapped to the Player class. To read about functions and their parameters, documentation: https://developers.google.com/youtube/iframe_api_reference#Functions
Every player support same events than API, since these are mapped to the Player class. var player = mootube.player('player', { video_id: 'OuoytdFfyXs', // Events onReady: function(event) { // Do something }, onStateChange: function(event) { // Do something }, onPlaybackQualityChange: function(event) { // Do something }, onPlaybackRateChange: function(event) { // Do something }, onError: function(event) { // Do something } }); To read about events, documentation: https://developers.google.com/youtube/iframe_api_reference#Events
Donations are welcome. By donating you contribute to this and other Open Source efforts.
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus