0.0.7 • Published 5 years ago

wc-youtube v0.0.7

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Embedded YouTube 📹 Player Web Component

A Web Component that allows you to embed a YouTube player in your application.

By Stefan Nieuwenhuis

npm (tag) npm Published on webcomponents.org

Installation

# via UNPKG
<script type="module" src="https://unpkg.com/wc-youtube@latest/dist/wc-youtube.js"></script>
# via npm
npm i wc-youtube

# or yarn
yarn add wc-youtube

Usage

<wc-youtube videoId="[enter-a-valid-YT-video-id-here]"></wc-youtube>

Demo

Click here to see the component live.

Attributes

The following attributes are available:

AttributeTypeDefault valueDescriptionPossible values
autoplaynumber0Specifies if a video automatically stats playing when the player loads0, 1
cc_lang_prefstringenSpecifies the default language for captions (ISO 639-1 format)Any ISO 639-1 two-letter language code
cc_load_policynumbernullSpecifies if closed captions are shown by default0, 1
colorstringnullSpecifies the color of the video's progress barred, white
controlsnumber1Specifies if the video controls are displayed0, 1
disablekbnumber0Specifies if the player responds to keyboard controls0, 1
enablejsapinumber0Specifies if the player responds to IFrame of JavaScript api calls0, 1
endnumbernullSpecifies the time, measured in seconds from the start of the video, when the player should stop playing the videoany positive integer
fsnumber1Specifies if the fullscreen button is displayed0, 1
heightnumber500Specifies the height of the playerany positive integer
hlstringenSpecifies the interface language (ISO 639-1 formatAny ISO 639-1 two-letter language code
iv_load_policynumber1Specifies if video annotations are shown1, 2, 3
liststringnullSpecifies the content that will load in the playersearchquery, username or playlistID
listTypestringnullSpecifies the content that will load in the playersearch, user_uploads, playlist
loopnumber0Specifies if the (list of) video(s) needs to be looped0, 1
modestbrandingnumbernullSpecifies if the YouTube logo is displayed. Disabled when color is set to white.0, 1
originstringwindow.location.originSpecifies the domain as the origin parameter valueorigin's domain name
playliststring[]Specifies a comma seperated list of videoId's to play. Video's in the list property will play afterany comma seperated list of valid videoId's
playsinlinenumber0Specifies if videos play inline or fullscreen in an HTML5 player on iOS0, 1
startstringnullSpecifies the time, measured in seconds from the start of the video, when the player should start playing the videoany positive integer
widthnumber500Specifies the width of the playerany positive integer
widget_referrerstringwindow.location.hrefSpecifies the URL where the player is embeddedthe url of the page

Usage:

<wc-youtube attribute="value"></wc-youtube>