A Simple Component For A Powerful YouTube IFrame Player API | VueYoutube

Vue youtube is a wrapper for the YouTube IFrame Player API (YIPA). A simple component of a powerful API. vue-youtube provides a simple layer for you to use your imagination while using the YouTube IFrame Player API.

vue youtube embed, vue youtube embed responsive, youtube iframe autoplay, youtube iframe api npm, youtube iframe api example, youtube iframe responsive

(Bootstrap + jQuery) A Responsive Custom YouTube Player With Horizontal Playlist

How to make use of it:

Install & Download:

# Yarn
$ yarn add vue-youtube

# NPM
$ npm install vue-youtube --save

Usage:

import Vue from 'vue'
import VueYoutube from 'vue-youtube'

Vue.use(VueYoutube)

<youtube :video-id="videoId" ref="youtube" @playing="playing"></youtube>
<button @click="playVideo">play</button>
export default {
  data() {
    return {
      videoId: 'lG0Ys-2d4MA'
    }
  },
  methods: {
    playVideo() {
      this.player.playVideo()
    },
    playing() {
      console.log('\o/ we are watching!!!')
    }
  },
  computed: {
    player () {
      return this.$refs.youtube.player
    }
  }
}

Props:

props: {
  height: {
    type: [Number, String],
    default: 360
  },
  width: {
    type: [Number, String],
    default: 640
  },
  videoId: {
    type: String,
    required: true
  },
  playerVars: {
    type: Object,
    default: function () {
      return { autoplay: 0 }
    }
  }
},

Props

PropType(s)DefaultDescription
widthNumber, String640iframe pixel width
heightNumber, String360iframe pixel height
resizeBooleanfalseiframe will proportionally scale height with its width
resizeDelayNumber200Delay in milliseconds before running resize callback
fitParentBooleanfalseiframe will use its parent’s width
nocookieBooleanfalseChange host param to www.youtube-nocookie.com

YouTube IFrame Player API, VueYoutube Plugin/Github


See Demo And Download

Official Website(anteriovieira): Click Here

This superior jQuery/javascript plugin is developed by anteriovieira. For extra Advanced Usages, please go to the official website.

Related Posts

Confetti-Falling-Animation-Effect-party

Confetti Falling Animation Effect In JavaScript | party.js

Party.js is a JavaScript library to brighten user site experience with visual effects! Celebrate success with dom confetti! The library is written in TypeScript and compiled into…

Star-Rating-JavaScript

Select Box Based Star Rating JavaScript Library | star-rating.js

star-rating.js is a small JavaScript library to create a customizable and gradually improved star rating control from a regular tick box with numeric values. The ES6 module…

Bootstrap-Show-Notification

Corner Fixed Notifications Alerts With Bootstrap | BS4 Show Notification

Bootstrap Notification is an easy-to-use jQuery plugin that uses the Bootstrap Alerts component to create static, rejectable, and stackable notification popups in the upper right corner of the…

Stackable-Multi-level-Sidebar-Menu

Create Stackable Multi-level Sidebar Menu | HC Off-canvas Nav

Multi-Level Sidebar Slide Menu – HC MobileNav is a jQuery plugin for creating multi-level, mobile-first, totally accessible, off-canvas facet navigation that helps the infinite nesting of submenu…

vue-masonry-gallery

Responsive Masonry Layout with SSR Support for Vue 3 | vue-masonry-wall

Vue masonry wall is a responsive masonry layout component for Vue 3 to deliver a Masonry-style responsive grid layout with SSR and RTL layout support. Features 📱…

bootstrap-5-bs-toaster

A Bootstrap 5 Toast Notification Framework Library | bs-toaster

bs-toaster is simple to instantiate bs-toaster and create multiple toasts effortlessly using native Bootstrap 5! Feature Facts Small and clean Modern browser support. No IE sorry 💥…