new account    login
jquery.mb.YTPlayer

Borrowed with full credit to http://pupunzi.com (Matteo Bicocchi)

 

jquery.mb.YTPlayer

 

jquery.mb.YTPlayer

This is a jQuery component that let you play a Youtube® movie in a chromeless player. You can even use a movie as background of your HTML page.

 

go to Demo page
go to blog page
go to download page

Dependencies:

  • jquery.metadata.js

JS call:

$(function(){ $(".movie").mb_YTPlayer(); });

HTMLconstructor:

<a id="bgndVideo" href="http://www.youtube.com/watch?v=MR9av-I35ME" class="movie {opacity:.4, isBgndMovie:{width:'1990',mute:false}, ratio:'4/3'}">Bill Viola</a>

Parameters:

Set the HTML elements for the controls:

  • $.YTPlayer.controls.play= "<img src='images/play.png'>"
  • $.YTPlayer.controls.pause= "<img src='images/pause.png'>"
  • $.YTPlayer.controls.mute= "<img src='images/mute.png'>"
  • $.YTPlayer.controls.unmute= "<img src='images/unmute.png'>"
additional info

meta data:

*metadata are parameters setted in the class attribute of the TAG.

  • opacity: (int) 0 → 1;
  • isBgndMovie: {width:'1990',mute:false} // or false or true (in this case the movie will be width: '100%' and mute:true by default);
  • ratio: '4/3' // or "16/9" to set the aspect ratio of the movie;
  • quality: 'default' // or "small", "medium", "large", "hd720"; (not implemented yet);
  • muteSound: true // or false (not implemented yet);
  • hasControls: true // or false (not implemented yet);
  • bufferImg: (string) Path to an image you whant to show while buffering;
  • ID: (string) the ID of the DOM element where you want the video background; if not specified it takes the "body".

For example:

<a id="bgndVideo" href="http://www.youtube.com/watch?v=MR9av-I35ME" class="movie {opacity:.4, isBgndMovie:{width:'1990',mute:false}, ratio:'4/3', quality:"hd720"}">Bill Viola</a>

Using jquery.mb.YTPlayer:

To initialize a YTPlayer as simple player:

  • set the meta data isBgndMovie of A tag to false;
  • set as HREF the url of the Youtube movie;
  • initialize the element or the elements: $(".movie").mb_YTPlayer();

 

To initialize a YTPlayer as background:

  • set the meta data isBgndMovie of A tag to true;
  • set as HREF the url of the Youtube movie;
  • set the opacity, the width, mute and the quality as meta data;
  • initialize the element or the elements: $(".movie").mb_YTPlayer();

To initialize a YTPlayer as element background (from v. 1.2.1):

  • set the meta data isBgndMovie of A tag to true;
  • set as HREF the url of the Youtube movie;
  • set the opacity, the width, mute, the quality and the ID of the element you want as target of the background movie as meta data;
  • initialize the element or the elements: $(".movie").mb_YTPlayer().