Skip to content

grafikri/youtube-iframe-api-module

Repository files navigation

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-module
import { 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'
  });
})

About

TypeScript & JavaScript wrapper for the YouTube IFrame API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published