Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adrianliaw/meteor-youtube-iframe-api
Youtube Iframe API Meteor package
https://github.com/adrianliaw/meteor-youtube-iframe-api
Last synced: about 1 month ago
JSON representation
Youtube Iframe API Meteor package
- Host: GitHub
- URL: https://github.com/adrianliaw/meteor-youtube-iframe-api
- Owner: adrianliaw
- License: mit
- Created: 2014-09-07T04:19:47.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-21T03:00:09.000Z (about 10 years ago)
- Last Synced: 2023-05-24T20:50:17.789Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://atmospherejs.com/adrianliaw/youtube-iframe-api
- Size: 232 KB
- Stars: 6
- Watchers: 2
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Meteor YouTube Iframe API
=========================YouTube Iframe API for Meteor
Basic Usage:
------------
Add package to project.meteor add adrianliaw:youtube-iframe-api
Some HTML Setups, you need to create a div with an id.
In JavaScript, you can include a video like this.
// Make sure it's in client
if (Meteor.isClient) {
// YouTube API will call onYouTubeIframeAPIReady() when API ready.
// Make sure it's a global variable.
onYouTubeIframeAPIReady = function () {
// New Video Player, the first argument is the id of the div.
// Make sure it's a global variable.
player = new YT.Player("player", {
height: "400",
width: "600",
// videoId is the "v" in URL (ex: http://www.youtube.com/watch?v=LdH1hSWGFGU, videoId = "LdH1hSWGFGU")
videoId: "LdH1hSWGFGU",
// Events like ready, state change,
events: {
onReady: function (event) {
// Play video when player ready.
event.target.playVideo();
}
}
});
};YT.load();
}### For full documentation of YouTube Iframe API, see [Google Developers](https://developers.google.com/youtube/iframe_api_reference)