vue-youtube-iframe
This plugin makes it easy to integrate the YouTube Iframe API into your Vue app. This plugin is Vue V3 compatible.
Usage
Installation
npm install @techassi/vue-youtube-iframe --save
or
yarn add @techassi/vue-youtube-iframe
Basic usage
main.js
import { createApp } from 'vue';
import App from './App.vue';
import VueYouTubeIframe from 'vue-youtube-iframe';
createApp(App).use(VueYouTubeIframe).mount('#app');
YourComponent.vue
<template>
<youtube-iframe :video-id="YT_VIDEO_ID"></youtube-iframe>
</template>
Advanced usage
YourComponent.vue
<template>
<youtube-iframe
:video-id="YT_VIDEO_ID"
:player-width="WIDTH"
:player-height="HEIGHT"
:no-cookie="TRUE / FALSE"
:player-parameters="YT_PLAYER_PARAMS"
@EVENT="CALLBACK"
></youtube-iframe>
</template>
Available props
:videoId / :video-id
: Specify the YT video id (e.g. dQw4w9WgXcQ
):playerWidth / :player-width
: Specify the player's width in pixels:playerHeight / :player-height
: Specify the player's height in pixels:noCookie / :no-cookie
: If set to true
the host will be set to https://www.youtube-nocookie.com
:playerParameters / :player-parameters
: Set player parameters, see here
Available player parameters
For the available player parameters see here
Available Events
@ready, @error, @ended, @playing, @paused, @buffering and @cued
For detailed event information check here
Contributing / Building
Contributions and pull request are welcome!
cd vue-youtube-iframe
yarn install / npm install
yarn run build / npm run build