svelte-lite-youtube-embed
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Svelte Lite YouTube Embed

Port of Paul Irish's Lite YouTube Embed to Svelte.

Install

npm install svelte-lite-youtube-embed

Basic Usage

<script>
  import LiteYouTube from 'svelte-lite-youtube-embed'
</script>

<LiteYouTube
  videoId="AdNJ3fydeao"
  videoTitle="Rich Harris - Rethinking reactivity"
/>

Pro Usage

<script>
  import LiteYouTube from 'svelte-lite-youtube-embed'
</script>

<LiteYouTube
  videoId="VLrYOji75Vc"
  videoTitle="Speed at Scale"
  playlistId="PL-G5r6j4GptH5JTveoLTVqpp7w2oc27Q9"
  params="enablejsapi=1"
  posterQuality="hqdefault"
  on:iframeLoaded={(e) => console.log(e.detail.iframe)}
/>

Options & events

Prop Type Description
videoId string Id of the video
videoTitle string Title of the video
videoPlay string Default: Play. This will be added to the button label for the announcement: "{videoPlay}: {videoTitle}"
posterQuality string. One of default, mqdefault, hqdefault, sddefault, maxresdefault Quality of the poster image
params string Any params to pass to the URL
playlistId string Id of the playlist. Note, videoId is still needed to display the poster
noCookie boolean Default: true. Use youtube-nocookie.com domain (instead of youtube.com) to prevent cookie tracking
posterLoading string. One of lazy, eager Default: lazy. Loading attribute value of poster img element
on:iframeLoaded function Callback that will fired when iframe loads

License

MIT License

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    237
    • latest

Version History

Package Sidebar

Install

npm i svelte-lite-youtube-embed

Weekly Downloads

237

Version

1.1.0

License

MIT

Unpacked Size

14.6 kB

Total Files

8

Last publish

Collaborators

  • zamanruhy