youtube-iframe-api-module
v1.1.3
Published
A lightweight TypeScript and JavaScript wrapper for the YouTube IFrame API, making it easy to use YouTube videos in npm-based projects and modern browser environments.
Maintainers
Readme
YouTube IFrame Api Module
This is an npm module version of the YouTube Player API for IFrame embeds. It automatically adds the iframe_api script to the browser. You can then refer to the YouTube Player API for IFrame API reference.
For the React version you can check out react-youtube-iframe-player.
Installation
npm install youtube-iframe-api-moduleimport { loadScript } from 'youtube-iframe-api-module';
loadScript(() => {
// Player 1
const player = new YT.Player('player-one', {
height: '390',
width: '640',
videoId: 'M7lc1UVf-VE'
});
})
loadScript(() => {
// Player 2
const player = new YT.Player('player-two', {
height: '390',
width: '640',
videoId: 'M7lc1UVf-VE'
});
})