npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue3-ytframe

v1.0.0

Published

A Vue3 YouTube Iframe API Wrapper Component

Readme

Features

  • 🧩 Single component that wraps the entire YouTube Iframe API (all methods & events)
  • 🟦 Ships TypeScript types — typed props, events, and the player instance
  • 🪶 Zero runtime dependencies beyond Vue 3 itself
  • ⏳ Promise-based API loading, so the player is created only once YouTube is ready
  • ♻️ Automatically destroys the player on unmount (no leaks)
  • 📦 Ships ESM and CommonJS builds (Node SSR / require() friendly)

Installation

npm install vue3-ytframe
# or: pnpm add vue3-ytframe / yarn add vue3-ytframe

Requires vue ^3.5 as a peer dependency.

Usage

Option A — register globally (plugin)

import { createApp } from "vue"
import VueYtframe from "vue3-ytframe"
import App from "./App.vue"

createApp(App).use(VueYtframe).mount("#app")

Option B — register locally (named export)

<script setup lang="ts">
import { VueYtframe } from "vue3-ytframe"
</script>

<template>
	<VueYtframe video-id="kGb9ftWR3l8" :player-vars="{ autoplay: 0 }" />
</template>

Controlling the player with a template ref

<script setup lang="ts">
import { ref } from "vue"
import { VueYtframe, type VueYtframeInstance } from "vue3-ytframe"

const yt = ref<VueYtframeInstance>()

function onReady() {
	yt.value?.playVideo()
}
</script>

<template>
	<VueYtframe ref="yt" video-id="kGb9ftWR3l8" @ready="onReady" />
</template>

Props

| Prop | Type | Default | Description | |--------------|-------------------|-----------|----------------------------------------------------------| | videoId | string | null | YouTube video ID. One of videoId/videoUrl required. | | videoUrl | string | null | Full YouTube URL (parsed to an ID internally). | | width | number \| string| "100%" | Player width. | | height | number \| string| "100%" | Player height. | | playerVars | object | {} | YouTube player parameters. |

Events

ready, playing, paused, ended, stateChange, playbackQualityChange, playbackRateChange, error, apiChange — each emits the underlying YT.Player. See the Events docs.

Methods

The full Iframe API surface is exposed on the component instance (playVideo, pauseVideo, seekTo, mute, setVolume, loadVideoById, …). The pure helper getVideoIdFromYoutubeURL(url) is also exported standalone. See the Methods docs.

Player methods throw a clear error if called before the ready event — wait for ready (or check the exposed player ref) before driving playback.

SSR (Nuxt, Quasar, etc.)

vue3-ytframe ships a .cjs build, so Node SSR servers can require() it without ERR_REQUIRE_ESM. The player itself uses the browser YouTube Iframe API (document, window), so render it client-only (e.g. Quasar's QNoSsr, Nuxt's <ClientOnly>).

Links

Contributing

pnpm install      # install deps
pnpm dev          # run the docs/playground site
pnpm test         # run the unit tests
pnpm typecheck    # vue-tsc type checking
pnpm lint         # eslint
pnpm build        # build the library + docs

Issues and PRs are welcome at the GitHub repository.

License

GPL-3.0 © Kiran Parajuli