Skip to content
master
Go to file
Code
This branch is 22 commits ahead of kvzhuang:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

README.md

youtube-iframe

It's an YouTube IFrame Player API wrapper for YUI.

Build Status

Build Status

How to use

  1. Add YouTube Iframe API library to your webpage.

    <script type="text/javascript" src="//www.youtube.com/iframe_api"></script>
  2. Sample code - config and player.

    var config = {
        "container": "#yt",  // HTML selector, it can be id, class or html tag name (like body)
        "size": ["1280px","780px"],  //width, height in px
        "hasControl": true,          //show control?
        "autoPlay": false,                   //auto play or not
        "url": "http://www.youtube.com/watch?v=faVCwOesYl8" //youtube url
    };
    var player = new Y.YoutubeIframe(config);
  3. Play YouTube video with an existed player.

    player.play("http://www.youtube.com/watch?v=faVCwOesYl8");
  4. Listen event

    player.on("ready", _handleReady);
    player.on("playing", function (e) {
        console.log(e.position + "/" + e.duration);
    });
    player.on("ended", _handleEnded);
    player.on("error", _handleError);

Reference

About

channel for youtube iframe API.

Resources

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.