jakiestfu / Youtube-TV

A small, slick, library independent YouTube User/Playlist player
https://github.com/jakiestfu/Youtube-TV#demos
205 stars 125 forks source link

YoutubeTV

A small, slick, library independent YouTube User/Playlist player

Features

Demos

Installation

Include both the ytv.css and ytv.js in your HTML file and you are good to go.

<link href="https://github.com/jakiestfu/Youtube-TV/blob/master/src/ytv.css" type="text/css" rel="stylesheet" />
<script src="https://github.com/jakiestfu/Youtube-TV/raw/master/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(){}
    }
}

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.

Share Meh!