Skip to main contentSidebar
On this page

Video Player

<pc-video-player>Since  1.0.0-alpha.5Experimental

Video players present visual media and provide controls for playback.

Edit

Demos

Poster

Use the poster attribute to add a poster (thumbnail) to the video, which shows before the video is played.

Edit

Autoplay

Use the autoplay attribute to start the video automatically.

Edit

Muted

Use the muted attribute to silence the video by default.

Edit

Loop

Use the loop attribute to make the video loop to the start again once it reaches the end.

Edit

No controls

Use the no-controls attribute to hide the video player controls.

Edit

Subtitles and captions

To add subtitles or captions, put a <track> element inside the default slot to import your WebVTT file.

Captions (which include dialogue alongside sound descriptions and speaker identifiers) should use kind="captions". Standard subtitles (which contain dialogue only) should use kind="subtitles".

Edit

Properties

NameDescriptionReflectsDefault
srcThe source of the video.
Type: string
""
posterThe placeholder image of the video if it hasn’t loaded yet.
Type: string
""
autoplayAutomatically plays the video without user interaction (i.e., pressing the play button).
Type: boolean
false
mutedMutes the video by default.
Type: boolean
false
loopLoops the video by default.
Type: boolean
false
preloadDetermines how much of the video is loaded before the user interacts with it.
Type: "none" | "metadata" | "auto"
"metadata"
noControls
no-controls
Hides the video player controls.
Type: boolean
false
dataTitle
data-title
Provides a custom title to the video.
Type: string
""
updateCompleteA read‐only promise that resolves when the component has finished updating.

Learn more about attributes and properties.

Slots

NameDescription
(default)The video player’s media sources and subtitle/caption tracks.

Learn more about using slots.

Methods

NameDescriptionArguments
play()Plays the video.
pause()Pauses the video.
toggle()Toggles the state of the video between play and pause.

Learn more about methods.

Events

NameDescriptionEvent detail
pc-playEmitted when the video is played.
pc-pauseEmitted when the video is paused.

Learn more about events.

Parts

NameDescription
frameThe video player’s frame.
initial-overlayThe video player’s initial overlay before the video starts.
initial-playThe initial overlay’s play button.
initial-play-baseThe initial play button’s base part.
initial-play-labelThe initial play button’s label part.
initial-play-iconThe initial play button’s <pc-icon> element.
initial-play-icon-svgThe <pc-icon> element’s svg part of the initial play button.
titleThe video player’s title.
videoThe video player’s internal <video> element.
captions-containerThe video player’s caption container.
caption-cueThe video player’s caption cue.
caption-line-containerThe video player’s caption cue line’s container.
caption-lineThe video player’s caption cue line.
progress-barThe video player’s progress bar container.
progress-wrapperThe progress bar’s progress wrapper.
progress-bufferThe progress wrapper’s buffer element.
progress-sliderThe progress wrapper’s slider.
progress-slider-sliderThe progress slider’s slider part.
progress-slider-trackThe progress slider’s track part.
progress-slider-indicatorThe progress slider’s indicator part.
progress-slider-thumbThe progress slider’s thumb part.
progress-slider-tooltipThe progress slider’s tooltip part.
progress-slider-tooltip-tooltipThe tooltip’s tooltip part of the progress slider.
progress-slider-tooltip-contentThe tooltip’s content part of the progress slider.
progress-slider-tooltip-arrowThe tooltip’s arrow part of the progress slider.
controlsThe video player’s controls.
playThe video player’s play button.
play-baseThe play button’s base part.
play-labelThe play button’s label part.
play-iconThe play button’s <pc-icon> element.
play-icon-svgThe <pc-icon> element’s svg part of the play button.
mute-containerThe container for the video player’s mute button and volume slider.
muteThe video player’s mute button.
mute-baseThe mute button’s base part.
mute-labelThe mute button’s label part.
mute-iconThe mute button’s <pc-icon> element.
volume-sliderThe volume slider.
volume-slider-sliderThe volume slider’s slider part.
volume-slider-trackThe volume slider’s track part.
volume-slider-indicatorThe volume slider’s indicator part.
volume-slider-thumbThe volume slider’s thumb part.
volume-slider-tooltipThe volume slider’s tooltip part.
volume-slider-tooltip-tooltipThe tooltip’s tooltip part of the volume slider.
volume-slider-tooltip-contentThe tooltip’s content part of the volume slider.
volume-slider-tooltip-arrowThe tooltip’s arrow part of the volume slider.
time-containerThe video player’s time container.
controls-groupThe video player’s controls group.
captionsThe video player’s captions button.
captions-baseThe captions button’s base part.
captions-labelThe captions button’s label part.
captions-iconThe captions button’s <pc-icon> element.
captions-icon-svgThe <pc-icon> element’s svg part of the captions button.
settings-menuThe video player’s settings menu.
settings-menu-baseThe settings menu’s base part.
settings-menu-menuThe settings menu’s menu part.
settings-buttonThe settings menu’s trigger button.
settings-button-baseThe settings button’s base part.
settings-button-labelThe settings button’s label part.
settings-button-iconThe settings button’s <pc-icon> element.
settings-button-icon-svgThe <pc-icon> element’s svg part of the settings button.
settings-menu-itemThe video player’s settings menu items.
settings-menu-item-checkmarkThe settings items’ checkmark part.
settings-menu-item-checkmark-svgThe settings items’ checkmark-svg part.
settings-menu-item-iconThe settings items’ icon part.
settings-menu-item-labelThe settings items’ label part.
settings-menu-item-detailsThe settings items’ details part.
settings-menu-item-submenu-iconThe settings items’ submenu-icon part.
settings-menu-item-submenu-icon-svgThe settings items’ submenu-icon-svg part.
settings-menu-item-submenuThe settings items’ submenu part.
settings-menu-dividerThe settings menu’s divider.
picture-in-pictureThe video player’s Picture in Picture button.
picture-in-picture-baseThe Picture in Picture button’s base part.
picture-in-picture-labelThe Picture in Picture button’s label part.
picture-in-picture-iconThe Picture in Picture button’s <pc-icon> element.
picture-in-picture-icon-svgThe <pc-icon> element’s svg part of the Picture in Picture button.
full-screenThe video player’s full screen button.
full-screen-baseThe full screen button’s base part.
full-screen-labelThe full screen button’s label part.
full-screen-iconThe full screen button’s <pc-icon> element.
full-screen-icon-svgThe <pc-icon> element’s svg part of the full screen button.

Learn more about customising CSS parts.

Importing

If you’re using the autoloader or the standard loader, you can skip this section. But if you’re cherry picking, you can use any of the following snippets to import this component.

CDN (script tag)CDN (import)npm (import)

To manually import this component from the CDN, copy this code snippet and paste it in your HTML.

<script type="module" src="https://cdn.jsdelivr.net/npm/placer-toolkit@1.0.0-alpha.6/cdn/components/video-player/video-player.js"></script>

To manually import this component from the CDN, copy this code snippet and paste it in your JavaScript file.

import "https://cdn.jsdelivr.net/npm/placer-toolkit@1.0.0-alpha.6/cdn/components/video-player/video-player.js";

To manually import this component from npm, copy this code snippet and paste it in your JavaScript file.

import "placer-toolkit/dist/components/video-player/video-player.js";

Dependencies

This component automatically imports these components:

We’d love to hear from you. Please reach out to us with any questions or enquiries you may have.

You can contact us via e‐mail at placer.coc.reports+contact@gmail.com.

We look forward to hearing from you!

Got it!
Dangerous lands

Whoa! You’ve wandered into the dangerous lands of Placer Toolkit. Version 0 is out of date and doesn’t meet EU privacy standards, including GDPR.

Want the latest powers, security and compliance? Stick with the current version of Placer Toolkit!

Yikes!Power up!

Our site is 100 % cookie‐free! We value your privacy, which is why we don’t store any cookies or personal information related to you.

Your browser history is safe from crumbs, and your data is protected, aligning with modern privacy standards like the GDPR. Enjoy your visit without a single digital cookie in sight! 🍪🚫

View our Privacy Policy for more information.

Got it!