Code Monkey home page Code Monkey logo

youtube-tv's Introduction

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

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 to
  • user: (String) The Username of the YouTube user you want to display videos from
  • playlist: (String) The Playlist ID you would like to load (Overrides user)
  • browsePlaylists: (Boolean) If true and the specified user has YouTube playlists, they will be accessible in the player by clicking the users Username
  • fullscreen: (Boolean) If true, the player will take up all the available space on the users browser screen
  • accent: (String) A CSS color string to apply to the accents of the player
  • controls: (Boolean) If false, the normal YouTube controls will be hidden.
  • annotations: (Boolean) If false, the annotations from the YouTube video will be hidden
  • autoplay: (Boolean) If true, the first video in the list will automatically play once the player has loaded
  • chainVideos: (Boolean) If true, the next video in que will automatically play after the current video has completed
  • wmode: (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.

Share Meh!

youtube-tv's People

Contributors

enminc avatar fabiosoggia avatar federico77 avatar jakiestfu avatar lightstrike avatar thinkingmik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

youtube-tv's Issues

videos is undefined

I noticed today, that this plugin wasn't working on a page it worked yesterday. And it gives the "videos is undefined" error.

Further digging revealed that this is using the Youtube Api v2 which is deprecated and they've already taken down some of the functions (?). So this would need an update to work with Youtube api v3. Is this plugin even maintained anymore?

I tried some quick fix: from row 107 to 123 there's the endpoints function which gets the data and I replaced some of the urls to match the api v3 getters to get playlistdata but I didn't get it to work.

Changes I tried, the originals are commented out
Row 108:

//base: 'http://gdata.youtube.com/',
base: 'https://developers.google.com/apis-explorer/#p/youtube/v3/',

Row 119:

//return utils.endpoints.base+'feeds/api/playlists/'+(settings.playlist)+'?v=2&alt=json&format=5&max-results=50';
return utils.endpoints.base+'youtube.playlistItems.list?part=snippet,contentDetails,status&playlistId='+(settings.playlist)+'&key=AIzaSyCzdE3rTJNED_zQmGnHDGxnIg3A4AR6Km4';

Any ideas for this?

Feature Requests: Hover Balloon & Video Date

I have a couple of feature requests:

  1. I needed to squeeze the player into a defined element, which drastically shortens the video titles. A hover balloon showing the full video title would be nice for smaller dimensions.
  2. Obviously (to me), the videos show up with the most recently added at the top, but there are people less gifted with sensible logic that need to see dates. :)

Thanks! I love the script and it's ease of use.

load by keywords from youtube

Hello, we need load a results of keywords in the playlist for example we want load videos having the following keyword only "Nirvana - About a Girl" or "nirvana - about a girl + karaoke"

please update this is very needed, we could even pay if is needed, thanks!

YouTube device support message

It appears that YouTube is upgrading to a new version which is not going to be supported with this plugin, does anyone know how to solve this?

youtube

Views not shown in version 1.0.2

Views are not shown in version 1.0.2, because of a missing = symbol

The line:

list+''+utils.addCommas(video.stats.viewCount)+' Views';

should be:

list+=''+utils.addCommas(video.stats.viewCount)+' Views';

Edit: overlooked issue #22

Not working with multiple attempts in a page

Hi,

We are using this plugin to show our youtube channel videos.It is working fine for the first time. For second time onwards it is not working. Ours is single page app.

We are replacing div content and call the same function the element will not work.

Please consider this.

Thanks.

Error: undefined is not a constructor (evaluating 'new YT.Player')

Hi,

We are (randomly) seeing strange behavior with the component on our website.
Most of the time it loads correctly, but sometimes it does not, giving the following error:

TypeError: undefined is not a constructor (evaluating 'new YT.Player')

Could this be due to the component not loading in time? Or do you see another reason?

Thanks

Feature Request: Make the player responsive by default

I've had to include some special styles for when the users browser hit mobile sizes to move the playlist below the video. Would be great to include this as a main feature.

I did an ugly hack but you can see the example....

@media only screen
and (max-width : 600px) {
    .ytv-list {
        height: 40% !important;
        left: 0;
        top: inherit !important;
        width: 100% !important;
    }
    .ytv-video{
        right: 0 !important;
        height: 60% !important;
    }
}

URL issues

Hi,
this code is awesome, exactly what I was searching for.
I'd like to know whether it would be possible to target a specific video through an url, since I'd love to be able to share specific videos from the site.

Thanks in advance.

channel is not working

When I inserted my channel name into the user, it appears blank with the background color #111111. Any solution or ideas well be welcome and appreciated thanks.

show newest first

Is there any way to show the newest video in the playlists first?

Delete me

My problem was not really a problem. Please delete this.

Multiple Player in one site

Is it possible to create 2 players with several playlists in one site?
If i try this the function call onYouTubeIframeAPIReady() override the first and only the last player will be shown.

channel is not working

Super awesome work done. But when I insert my channel or playlist name inside the user, it appears blank with the background color #111111. Any help or ideas to rectify this problem will be welcome and appreciated thanks.

wmode=opaque

The current plugin release has one overlapping issue when you need the iframe to slide behind the div. Looks like Chrome is the most prone to show the glitch.

To solve it you just have to add '&wmode=opaque' to the iframe src.

I would have loved to fix it myself but I'm not good with js.

Kind regards

Some channels work and some don't.

Hi! I love Youtube TV! It inspired me to make a .tv that is dedicated to my youtube channel. Only one problem though, I can't seem to get it to work with some channels. For example, when I tell it to connect with my channel "gamerebelnetworks", it works absolutely perfect. But when I add my channel "radiorebelnetworks" it goes blank! Obviously there is something different between these two channels that causes it to do this. Any ideas?

Btw, when I tell it to display a playlist instead, it works perfectly. But I would like the front page to display the newest videos added to the channel instead of a specific playlist.

Thanks so much!

Changing the load order of the videos?

Hello there. This plugin is awesome. I have one question, is there any way to change the default load order of the videos? For example, video number two in the playlist lineup is the one I would like to load first. Or is this done through YouTube settings?

Thanks again for this cool plugin and thanks for providing it for free, it is awesome!

Channel doesn't work

I have this error and I don't know why..

TypeError: video.stats is undefined

window.onload = function(){

    window.controller = new YTV('frame', {
        user: 'LesJeuxduQuebec',
        accent: '#008D54',
        browsePlaylists: true,
        controls: false,
        autoplay: true
    });

};

Viewing Private videos

Hi,
Is there a way that we can view the private videos that have been enabled for that user ?
Currently, it lists only the public videos for the channel for that user.

Thanks,
Pallavi

Youtube TV in Google Sites - load Playlists on load

I'm not very au fait with github, don't find it very user friendly for novices, so excuse me for posting this here.

With thanks to John at Dynamic Drive / forum, I have been tweaking this YouTube gallery to work in Google Sites.
The list now displays by default with the Playlist displayed, instead of displaying the numerous videos in the YouTube account.

And when a playlist is selected, the videos in that playlist remain displayed until the button is clicked on to display all playlists again

It also has a mouse over of "Click to open the Playlist - ~"

But I wonder if there is a way to make it display the Playlist without loading "all videos" first - to stop the loading flicker?

And I wonder if there is a way for it to display the playlists alphabetically A - Z ?

Page is http://www.dorsetdog.com/you-tube-videos

The js file is at https://sites.google.com/site/dorsetdogshow/youtube-gallery.js

If I've posted this in the wrong place, then please be good enough to remove it rather than just deleting it.

Thanks

Mark

converting the player to integrate a typical jQuery carousel

Hi Jacob,

I would like to convert the right-hand vertical list of clips, currently in a scrollable panel, into a typical jQuery horizontal carousel scroll/thumbnail mechanism with left/right buttons. I've done the css bit: http://jsfiddle.net/nCNcL/

To start with I had a stab at trying to 'say hello' to the ul elements via jQuery but this didn't work (lines 415-420 in the js).

Many thanks

Stability problem with multiple players on the same page

Thank you for this beautiful code!

I have a stability problem with multiple players on the same page.

The preview of the first video does not always appear on the left side of the player. And some players do not respond (especially those who are lower in the page) when I want to start a video.

Could you help me with this issue?

Thank you!

A basic working example

Hi there, I really appreciate your work.

I've been dicking around with this for an hour, and havent got any videos to load so far.
could you confirm if any of the examples work by default? If not, could you chuck one in there?

Thanks very much

Social Integration, description, comments

Add support/options for the following features:

  • Add FB/Twitter/Google Plus/Reddit Share button support
  • Add option to show video description somewhere
  • Add option to show discussion/comments, either through some YouTube API or something like Disqus or LiveFyre,

Playlist

Can't play any playlist only a list of video. The "string" playlist does not work with me… My user (me) has no video but only a playlist, what could I do ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.