https://github.com/b13/js-youtube
https://github.com/b13/js-youtube
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/b13/js-youtube
- Owner: b13
- Created: 2014-06-18T16:03:34.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-09-11T09:17:21.000Z (almost 11 years ago)
- Last Synced: 2025-12-01T09:03:31.531Z (7 months ago)
- Language: JavaScript
- Size: 184 KB
- Stars: 0
- Watchers: 11
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
js-youtube
=================
Module to load youtube iFrame API with requireJS and init the youtube player.
# requireJS config
```js
var require = {
paths: {
'jquery' : 'path/to/jquery'
, 'youTube' : 'path/to/youtube'
, 'youTubeIFrameAPI' : 'https://www.youtube.com/iframe_api?noext'
}
, shim: {
"youTubeIFrameAPI": {
exports: 'YT'
}
}
};
```
# Basic usage
```js
require(['youTube'], function(youTube) {
// do youtube setup and init player
var player = new youTube({
id : id
, youTubeId : youTubeId
, height : 400
, width : 600
, onPlaying : function() {}
, onPaused : function() {}
, onEnded : function() {}
});
// start video
player.play();
// pause video
player.pause();
// stop video
player.stop();
// get youtube player object
var ytObj = player.getYouTubePlayer();
});
```