YoutubeTV
A small, slick, library independent YouTube User/Playlist player
Features
- Library Independent
- Customizable via CSS
- Autoplay
- Remove YouTube Chrome
- Supports Playlists and Users
- jQuery Support
- Module Support
Demos
- Default Player Options
- Chromeless Player
- Playlist Support
- Full Screen Player (Good for a .tv website?)
- jQuery Support
Installation
Include both the ytv.css
and ytv.js
in your HTML file and you are good to go.
<link href="src/ytv.css" type="text/css" rel="stylesheet" />
<script src="src/ytv.js" type="text/javascript"></script>
Usage
After your page has loaded, you may call the script like so:
var controller = new YTV(element, {
user: 'YoutubeUsername'
});
YTV
accepts two parameters. The first is a string of the element ID you want to use as the player, OR it may the element itself. The second parameter is an object of options defined below:
Settings and Defaults
settings = {
element: null,
user: null,
playlist: '',
fullscreen: false,
accent: '#fff',
controls: true,
annotations: false,
autoplay: false,
chainVideos: true,
browsePlaylists: false,
wmode: 'opaque',
events: {
videoReady: function(){},
stateChange: function(){}
}
}
element
: The element or element ID to apply the YouTube TV Player touser
: (String) The Username of the YouTube user you want to display videos fromplaylist
: (String) The Playlist ID you would like to load (Overridesuser
)browsePlaylists
: (Boolean) Iftrue
and the specifieduser
has YouTube playlists, they will be accessible in the player by clicking the users Usernamefullscreen
: (Boolean) Iftrue
, the player will take up all the available space on the users browser screenaccent
: (String) A CSS color string to apply to the accents of the playercontrols
: (Boolean) Iffalse
, the normal YouTube controls will be hidden.annotations
: (Boolean) Iffalse
, the annotations from the YouTube video will be hiddenautoplay
: (Boolean) Iftrue
, the first video in the list will automatically play once the player has loadedchainVideos
: (Boolean) Iftrue
, the next video in que will automatically play after the current video has completedwmode
: (String) Sets the Window Mode property for transparency, layering, and positioning in the browser. Values can be:window
- movie plays in its own rectangular window on a web page.opaque
- the movie hides everything on the page behind it.transparent
- the background of the HTML page shows through all transparent portions of the movie, this may slow animation performance.events
: The respective events will fire when key actions in the player have been called
Public Methods
destroy
Destroys the YouTube TV Player and all associated elements/events
controller.destroy();
fullscreen.state()
Returns true
if in Fullscreen Mode
controller.fullscreen.state();
fullscreen.enter()
Enters into Fullscreen Mode
controller.fullscreen.enter();
fullscreen.exit()
Exits Fullscreen Mode
controller.fullscreen.exit();
jQuery Support
YTV may be used as a jQuery plugin in the following fashion:
$('#frame').ytv({opts});
Licensing
MIT Licensing
Copyright (c) 2013 Jacob Kelley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.