SeaniaTwix / svelte-yt

A wrapper around the YouTube IFrame API for Svelte

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

svelte-yt

A wrapper around the YouTube IFrame API.

Based on svelte-youtube.

Installation

npm install svelte-yt

Usage

<script lang="ts">
	import { YouTube } from 'svelte-yt';

	let videoId = 'M7lc1UVf-VE';
    // Can be used to control full YouTube player
    // See https://developers.google.com/youtube/iframe_api_reference#Functions
	let player;

    // See https://developers.google.com/youtube/player_parameters#Parameters
	const options = {
		playerVars: {
			modestbranding: 1
		}
	};
</script>

<YouTube bind:player on:play={(e) => console.log(e)} {videoId} {options} />
<button on:click={() => player.playVideo()}>Play</button>

About

A wrapper around the YouTube IFrame API for Svelte

License:MIT License


Languages

Language:Svelte 67.3%Language:JavaScript 25.7%Language:HTML 7.0%