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 🙏

© 2024 – Pkg Stats / Ryan Hefner

youtube-vue3

v0.1.15

Published

Youtube player component for vue.js 3.x

Downloads

2,322

Readme

youtube-vue3

Youtube Player Component for Vue.js 3.x.
This is based on youtube-player

Youtube Player for Vue 2.x--> Here

npm npm GitHub stars GitHub forks Build Status license


Contact : [email protected]
Author : Stephen Won(원형섭), OpenSG Inc.
Online Demo : https://youtube-vue3.vercel.app/

Screen Shot

License

MIT

Usage

CDN - install

<script type="text/javascript" src="https://unpkg.com/vue@next"></script>
<script type="text/javascript" src="https://unpkg.com/youtube-vue3"></script>

CDN - usage

<div id="app">
	<div>
		<youtube-vue3 :videoid="video_id" :loop="loop" :autoplay="autoplay" />
	</div>
</div>
<script src="https://unpkg.com/vue@next"></script>
<script src="https://unpkg.com/youtube-vue3" type="text/javascript"></script>
<script type="text/javascript">
const app = Vue.createApp({
	name : "App",
	data() {
		return {
		  video_id:"3P1CnWI62Ik", loop:0, autoplay:1
		}
	},

})
YoutubeVue3.default(app)
const vm = app.mount("#app")
</script>
......

NPM - install

npm install --save youtube-vue3
- or -
yarn add youtube-vue3

NPM - usage

<template>
  <div>
    <div>
      video_id : <input type="text" v-model="temp.video_id" /><br />
      loop : <input type="number"  v-model.number="temp.loop" /><br />
      <button @click="applyConfig">Apply</button>
      <button @click="playCurrentVideo">Play</button>
      <button @click="stopCurrentVideo">Stop</button>
      <button @click="pauseCurrentVideo">Pause</button>
    </div>
    <YoutubeVue3 ref="youtube" :videoid="play.video_id" :loop="play.loop" :width="480" :height="320"
      @ended="onEnded" @paused="onPaused" @played="onPlayed"/>
  </div>
</template>

<script>
import { YoutubeVue3 } from 'youtube-vue3'

export default {
  name: 'App',
  data() {
    return {
      temp: { video_id:"3P1CnWI62Ik", loop:1 },
      play : { video_id:"3P1CnWI62Ik", loop:1 }
    }
  },
  components: {
    YoutubeVue3
  },
  methods: {
    applyConfig() {
      this.play = Object.assign(this.play, this.temp)
    },
    playCurrentVideo() {
      this.$refs.youtube.player.playVideo();
    },
    stopCurrentVideo() {
      this.$refs.youtube.player.stopVideo();
    },
    pauseCurrentVideo() {
      this.$refs.youtube.player.pauseVideo();
    },
    onEnded() {
      console.log("## OnEnded")
    },
    onPaused() {
      console.log("## OnPaused")
    },
    onPlayed() {
      console.log("## OnPlayed")
    }
  }
}
</script>

Props

  • width
    • type : Number
    • width of player
  • height
    • type : Number
    • height of player
  • autoplay
    • type : Number
    • default value : 0
    • autoplay of player ( 0 , 1:autoplay)
  • videoid
    • type : String
    • Youtube video id
  • loop
    • type : Number
    • default value : 0
    • a setting of 1 causes the player to play the initial video again and again
  • controls
    • type : Number
    • default value : 0
    • https://developers.google.com/youtube/player_parameters#controls
  • modestbranding
    • type : Number
    • default value : 1
    • https://developers.google.com/youtube/player_parameters#modestbranding

methods

  • playVideo()
  • stopVideo()
  • mute()
  • unMute()
  • setVolume(number) : number => 0~100
  • getVolume()
  • setSize(width, height) : you can set player size on run-time

events

  • ended : when current video is ended
  • paused : when current video is pauded
  • played : when video is played
  • ready : when player is ready state