Skip to content

Wrapper for dynamically loading the YouTube iframe api script

License

Notifications You must be signed in to change notification settings

jantimon/youtube-iframe

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

youtube-iframe

Wrapper for dynamically loading the YouTube iframe api script

npm install youtube-iframe

Can be used with browserify or global window.YouTubeIframeLoader.

var YouTubeIframeLoader = require('youtube-iframe');

YouTubeIframeLoader.load(function(YT) {
	new YT.Player('player1', {
		height: '390',
		width: '640',
		videoId: 'M7lc1UVf-VE'
	});
});

YouTubeIframeLoader.load(function(YT) {
	new YT.Player('player2', {
		height: '390',
		width: '640',
		videoId: 'dQw4w9WgXcQ'
	});
});

Changelog

1.0.2

  • Always call the callback asynchronously (#2)
  • Fixed a bug with infinite recursion when nesting load() calls

1.0.1

  • Always use https instead of the protocol-relative URL (#1)

About

Wrapper for dynamically loading the YouTube iframe api script

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 57.9%
  • JavaScript 42.1%