A simple HTML5, YouTube and Vimeo player

Overview

Plyr is a simple, lightweight, accessible and customizable HTML5, YouTube and Vimeo media player that supports modern browsers.

Checkout the demo - Donate - Slack

npm version Gitpod Ready-to-Code Financial Contributors on Open Collective

Image of Plyr

Features

  • 📼 HTML Video & Audio, YouTube & Vimeo - support for the major formats
  • 💪 Accessible - full support for VTT captions and screen readers
  • 🔧 Customizable - make the player look how you want with the markup you want
  • 😎 Clean HTML - uses the right elements. <input type="range"> for volume and <progress> for progress and well, <button>s for buttons. There's no <span> or <a href="#"> button hacks
  • 📱 Responsive - works with any screen size
  • 💵 Monetization - make money from your videos
  • 📹 Streaming - support for hls.js, Shaka and dash.js streaming playback
  • 🎛 API - toggle playback, volume, seeking, and more through a standardized API
  • 🎤 Events - no messing around with Vimeo and YouTube APIs, all events are standardized across formats
  • 🔎 Fullscreen - supports native fullscreen with fallback to "full window" modes
  • ⌨️ Shortcuts - supports keyboard shortcuts
  • 🖥 Picture-in-Picture - supports picture-in-picture mode
  • 📱 Playsinline - supports the playsinline attribute
  • 🏎 Speed controls - adjust speed on the fly
  • 📖 Multiple captions - support for multiple caption tracks
  • 🌎 i18n support - support for internationalization of controls
  • 👌 Preview thumbnails - support for displaying preview thumbnails
  • 🤟 No frameworks - written in "vanilla" ES6 JavaScript, no jQuery required
  • 💁‍♀️ SASS - to include in your build processes

Demos

You can try Plyr in Codepen using our minimal templates: HTML5 video, HTML5 audio, YouTube, Vimeo. For Streaming we also have example integrations with: Dash.js, Hls.js and Shaka Player

Quick setup

HTML

Plyr extends upon the standard HTML5 media element markup so that's all you need for those types.

HTML5 Video

<video id="player" playsinline controls data-poster="/path/to/poster.jpg">
  <source src="/path/to/video.mp4" type="video/mp4" />
  <source src="/path/to/video.webm" type="video/webm" />

  <!-- Captions are optional -->
  <track kind="captions" label="English captions" src="/path/to/captions.vtt" srclang="en" default />
</video>

Note: The poster image should be specified using data-poster. This is to prevent it being downloaded twice. If you're sure the image will be cached, you can still use the poster attribute for true progressive enhancement.

HTML5 Audio

<audio id="player" controls>
  <source src="/path/to/audio.mp3" type="audio/mp3" />
  <source src="/path/to/audio.ogg" type="audio/ogg" />
</audio>

For YouTube and Vimeo players, Plyr uses progressive enhancement to enhance the default <iframe> embeds. Below are some examples. The plyr__video-embed classname will make the embed responsive. You can add the autoplay, loop, hl (YouTube only) and playsinline (YouTube only) query parameters to the URL and they will be set as config options automatically. For YouTube, the origin should be updated to reflect the domain you're hosting the embed on, or you can opt to omit it.

YouTube

We recommend progressive enhancement with the embedded players. You can elect to use an <iframe> as the source element (which Plyr will progressively enhance) or a bog standard <div> with two essential data attributes - data-plyr-provider and data-plyr-embed-id.

<div class="plyr__video-embed" id="player">
  <iframe
    src="https://www.youtube.com/embed/bTqVqk7FSmY?origin=https://plyr.io&amp;iv_load_policy=3&amp;modestbranding=1&amp;playsinline=1&amp;showinfo=0&amp;rel=0&amp;enablejsapi=1"
    allowfullscreen
    allowtransparency
    allow="autoplay"
  ></iframe>
</div>

Note: The plyr__video-embed classname will make the player a responsive 16:9 (most common) iframe embed. When plyr itself kicks in, your custom ratio config option will be used.

Or the <div> non progressively enhanced method:

<div id="player" data-plyr-provider="youtube" data-plyr-embed-id="bTqVqk7FSmY"></div>

Note: The data-plyr-embed-id can either be the video ID or URL for the media.

Vimeo

Much the same as YouTube above.

<div class="plyr__video-embed" id="player">
  <iframe
    src="https://player.vimeo.com/video/76979871?loop=false&amp;byline=false&amp;portrait=false&amp;title=false&amp;speed=true&amp;transparent=0&amp;gesture=media"
    allowfullscreen
    allowtransparency
    allow="autoplay"
  ></iframe>
</div>

Or the <div> non progressively enhanced method:

<div id="player" data-plyr-provider="vimeo" data-plyr-embed-id="76979871"></div>

JavaScript

You can use Plyr as an ES6 module as follows:

import Plyr from 'plyr';

const player = new Plyr('#player');

Alternatively you can include the plyr.js script before the closing </body> tag and then in your JS create a new instance of Plyr as below.

<script src="path/to/plyr.js"></script>
<script>
  const player = new Plyr('#player');
</script>

See initialising for more information on advanced setups.

You can use our CDN (provided by Fastly) for the JavaScript. There's 2 versions; one with and one without polyfills. My recommendation would be to manage polyfills seperately as part of your application but to make life easier you can use the polyfilled build.

<script src="https://cdn.plyr.io/3.6.4/plyr.js"></script>

...or...

<script src="https://cdn.plyr.io/3.6.4/plyr.polyfilled.js"></script>

CSS

Include the plyr.css stylsheet into your <head>.

<link rel="stylesheet" href="path/to/plyr.css" />

If you want to use our CDN (provided by Fastly) for the default CSS, you can use the following:

<link rel="stylesheet" href="https://cdn.plyr.io/3.6.4/plyr.css" />

SVG Sprite

The SVG sprite is loaded automatically from our CDN (provided by Fastly). To change this, see the options below. For reference, the CDN hosted SVG sprite can be found at https://cdn.plyr.io/3.6.4/plyr.svg.

Ads

Plyr has partnered up with vi.ai to offer monetization options for your videos. Getting setup is easy:

Any questions regarding the ads can be sent straight to vi.ai and any issues with rendering raised through GitHub issues.

If you do not wish to use Vi, you can set your own ads.tagUrl option.

Advanced

Customizing the CSS

If you want to change any design tokens used for the rendering of the player, you can do so using CSS Custom Properties.

Here's a list of the properties and what they are used for:

Name Description Default / Fallback
--plyr-color-main The primary UI color. #f03c15 #00b3ff
--plyr-video-background The background color of video and poster wrappers for using alpha channel videos and poster images. rgba(0, 0, 0, 1)
--plyr-tab-focus-color The color used for the dotted outline when an element is :focus-visible (equivalent) keyboard focus. --plyr-color-main
--plyr-badge-background The background color for badges in the menu. #4a5464 #4a5464
--plyr-badge-text-color The text color for badges. #ffffff #ffffff
--plyr-badge-border-radius The border radius used for badges. 2px
--plyr-tab-focus-color The color used to highlight tab (keyboard) focus. --plyr-color-main
--plyr-captions-background The color for the background of captions. rgba(0, 0, 0, 0.8)
--plyr-captions-text-color The color used for the captions text. #ffffff #ffffff
--plyr-control-icon-size The size of the icons used in the controls. 18px
--plyr-control-spacing The space between controls (sometimes used in a multiple - e.g. 10px / 2 = 5px). 10px
--plyr-control-padding The padding inside controls. --plyr-control-spacing * 0.7 (7px)
--plyr-control-radius The border radius used on controls. 3px
--plyr-control-toggle-checked-background The background color used for checked menu items. --plyr-color-main
--plyr-video-controls-background The background for the video controls. linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75))
--plyr-video-control-color The text/icon color for video controls. #ffffff #ffffff
--plyr-video-control-color-hover The text/icon color used when video controls are :hover, :focus and :focus-visible (equivalent). #ffffff #ffffff
--plyr-video-control-background-hover The background color used when video controls are :hover, :focus and :focus-visible (equivalent). --plyr-color-main
--plyr-audio-controls-background The background for the audio controls. #ffffff #ffffff
--plyr-audio-control-color The text/icon color for audio controls. #4a5464 #4a5464
--plyr-audio-control-color-hover The text/icon color used when audio controls are :hover, :focus and :focus-visible (equivalent). #ffffff #ffffff
--plyr-audio-control-background-hover The background color used when video controls are :hover, :focus and :focus-visible (equivalent). --plyr-color-main
--plyr-menu-background The background color for menus. rgba(255, 255, 255, 0.9)
--plyr-menu-color The text/icon color for menu items. #4a5464 #4a5464
--plyr-menu-shadow The shadow used on menus. 0 1px 2px rgba(0, 0, 0, 0.15)
--plyr-menu-radius The border radius on the menu. 4px
--plyr-menu-arrow-size The size of the arrow on the bottom of the menu. 6px
--plyr-menu-item-arrow-color The color of the arrows in the menu. #728197 #728197
--plyr-menu-item-arrow-size The size of the arrows in the menu. 4px
--plyr-menu-border-color The border color for the bottom of the back button in the top of the sub menu pages. #dcdfe5 #dcdfe5
--plyr-menu-border-shadow-color The shadow below the border of the back button in the top of the sub menu pages. #ffffff #ffffff
--plyr-progress-loading-size The size of the stripes in the loading state in the scrubber. 25px
--plyr-progress-loading-background The background color on the loading state in the scrubber. rgba(35, 40, 47, 0.6)
--plyr-video-progress-buffered-background The fill color for the buffer indication in the scrubber for video. rgba(255, 255, 255, 0.25)
--plyr-audio-progress-buffered-background The fill color for the buffer indication in the scrubber for audio. rgba(193, 200, 209, 0.6)
--plyr-range-thumb-height The height of the scrubber handle/thumb. 13px
--plyr-range-thumb-background The background of the scrubber handle/thumb. #ffffff #ffffff
--plyr-range-thumb-shadow The shadow of the scrubber handle/thumb. 0 1px 1px rgba(215, 26, 18, 0.15), 0 0 0 1px rgba(215, 26, 18, 0.2)
--plyr-range-thumb-active-shadow-width The width of the shadow when the scrubber handle/thumb is :active (pressed). 3px
--plyr-range-track-height The height of the scrubber/progress track. 5px
--plyr-range-fill-background The fill color of the scrubber/progress. --plyr-color-main
--plyr-video-range-track-background The background of the scrubber/progress. --plyr-video-progress-buffered-background
--plyr-video-range-thumb-active-shadow-color The color of the shadow when the video scrubber handle/thumb is :active (pressed). rgba(255, 255, 255, 0.5)
--plyr-audio-range-track-background The background of the scrubber/progress. --plyr-video-progress-buffered-background
--plyr-audio-range-thumb-active-shadow-color The color of the shadow when the audio scrubber handle/thumb is :active (pressed). rgba(215, 26, 18, 0.1)
--plyr-tooltip-background The background color for tooltips. rgba(255, 255, 255, 0.9)
--plyr-tooltip-color The text color for tooltips. #4a5464 #4a5464
--plyr-tooltip-padding The padding for tooltips. calc(var(--plyr-control-spacing) / 2))
--plyr-tooltip-arrow-size The size of the arrow under tooltips. 4px
--plyr-tooltip-radius The border radius on tooltips. 3px
--plyr-tooltip-shadow The shadow on tooltips. 0 1px 2px rgba(0, 0, 0, 0.15)
--plyr-font-family The font family used in the player.
--plyr-font-size-base The base font size. Mainly used for captions. 15px
--plyr-font-size-small The smaller font size. Mainly used for captions. 13px
--plyr-font-size-large The larger font size. Mainly used for captions. 18px
--plyr-font-size-xlarge The even larger font size. Mainly used for captions. 21px
--plyr-font-size-time The font size for the time. --plyr-font-size-small
--plyr-font-size-menu The font size used in the menu. --plyr-font-size-small
--plyr-font-size-badge The font size used for badges. 9px
--plyr-font-weight-regular The regular font weight. 400
--plyr-font-weight-bold The bold font weight. 600
--plyr-line-height The line height used within the player. 1.7
--plyr-font-smoothing Whether to enable font antialiasing within the player. false

You can set them in your CSS for all players:

:root {
  --plyr-color-main: #1ac266;
}

...or for a specific class name:

.player {
  --plyr-color-main: #1ac266;
}

...or in your HTML:

<video class="player" style="--plyr-color-main: #1ac266;">
    ...
</video>

SASS

You can use plyr.scss file included in /src/sass as part of your build and change variables to suit your design. The SASS requires you to use autoprefixer (you should be already!) as all declarations use the W3C definitions.

The HTML markup uses the BEM methodology with plyr as the block, e.g. .plyr__controls. You can change the class hooks in the options to match any custom CSS you write. Check out the JavaScript source for more on this.

SVG

The icons used in the Plyr controls are loaded in an SVG sprite. The sprite is automatically loaded from our CDN by default. If you already have an icon build system in place, you can include the source plyr icons (see /src/sprite for source icons).

Using the iconUrl option

You can however specify your own iconUrl option and Plyr will determine if the url is absolute and requires loading by AJAX/CORS due to current browser limitations or if it's a relative path, just use the path directly.

If you're using the <base> tag on your site, you may need to use something like this: svgfixer.js

More info on SVG sprites here: http://css-tricks.com/svg-sprites-use-better-icon-fonts/ and the AJAX technique here: http://css-tricks.com/ajaxing-svg-sprite/

Cross Origin (CORS)

You'll notice the crossorigin attribute on the example <video> elements. This is because the TextTrack captions are loaded from another domain. If your TextTrack captions are also hosted on another domain, you will need to add this attribute and make sure your host has the correct headers setup. For more info on CORS checkout the MDN docs: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

Captions

WebVTT captions are supported. To add a caption track, check the HTML example above and look for the <track> element. Be sure to validate your caption files.

JavaScript

Initialising

You can specify a range of arguments for the constructor to use:

Note: If a NodeList, Array, or jQuery object are passed, the first element will be used for setup. To setup multiple players, see multiple players below.

Single player

Passing a CSS string selector that's compatible with querySelector:

const player = new Plyr('#player');

Passing a HTMLElement:

const player = new Plyr(document.getElementById('player'));
const player = new Plyr(document.querySelector('.js-player'));

The HTMLElement or string selector can be the target <video>, <audio>, or <div> wrapper for embeds.

Multiple players

You have two choices here. You can either use a simple array loop to map the constructor:

const players = Array.from(document.querySelectorAll('.js-player')).map(p => new Plyr(p));

...or use a static method where you can pass a CSS string selector, a NodeList, an Array of HTMLElement, or a JQuery object:

const players = Plyr.setup('.js-player');

Both options will also return an array of instances in the order of they were in the DOM for the string selector or the source NodeList or Array.

Options

The second argument for the constructor is the options object:

const player = new Plyr('#player', {
  title: 'Example Title',
});

Options can be passed as an object to the constructor as above or as JSON in data-plyr-config attribute on each of your target elements:

<video src="/path/to/video.mp4" id="player" controls data-plyr-config='{ "title": "Example Title" }'></video>

Note the single quotes encapsulating the JSON and double quotes on the object keys. Only string values need double quotes.

Option Type Default Description
enabled Boolean true Completely disable Plyr. This would allow you to do a User Agent check or similar to programmatically enable or disable Plyr for a certain UA. Example below.
debug Boolean false Display debugging information in the console
controls Array, Function or Element ['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', 'fullscreen'] If a function is passed, it is assumed your method will return either an element or HTML string for the controls. Three arguments will be passed to your function; id (the unique id for the player), seektime (the seektime step in seconds), and title (the media title). See CONTROLS.md for more info on how the html needs to be structured.
settings Array ['captions', 'quality', 'speed', 'loop'] If the default controls are used, you can specify which settings to show in the menu
i18n Object See defaults.js Used for internationalization (i18n) of the text within the UI.
loadSprite Boolean true Load the SVG sprite specified as the iconUrl option (if a URL). If false, it is assumed you are handling sprite loading yourself.
iconUrl String null Specify a URL or path to the SVG sprite. See the SVG section for more info.
iconPrefix String plyr Specify the id prefix for the icons used in the default controls (e.g. "plyr-play" would be "plyr"). This is to prevent clashes if you're using your own SVG sprite but with the default controls. Most people can ignore this option.
blankVideo String https://cdn.plyr.io/static/blank.mp4 Specify a URL or path to a blank video file used to properly cancel network requests.
autoplay² Boolean false Autoplay the media on load. If the autoplay attribute is present on a <video> or <audio> element, this will be automatically set to true.
autopause¹ Boolean true Only allow one player playing at once.
seekTime Number 10 The time, in seconds, to seek when a user hits fast forward or rewind.
volume Number 1 A number, between 0 and 1, representing the initial volume of the player.
muted Boolean false Whether to start playback muted. If the muted attribute is present on a <video> or <audio> element, this will be automatically set to true.
clickToPlay Boolean true Click (or tap) of the video container will toggle play/pause.
disableContextMenu Boolean true Disable right click menu on video to help as very primitive obfuscation to prevent downloads of content.
hideControls Boolean true Hide video controls automatically after 2s of no mouse or focus movement, on control element blur (tab out), on playback start or entering fullscreen. As soon as the mouse is moved, a control element is focused or playback is paused, the controls reappear instantly.
resetOnEnd Boolean false Reset the playback to the start once playback is complete.
keyboard Object { focused: true, global: false } Enable keyboard shortcuts for focused players only or globally
tooltips Object { controls: false, seek: true } controls: Display control labels as tooltips on :hover & :focus (by default, the labels are screen reader only). seek: Display a seek tooltip to indicate on click where the media would seek to.
duration Number null Specify a custom duration for media.
displayDuration Boolean true Displays the duration of the media on the "metadataloaded" event (on startup) in the current time display. This will only work if the preload attribute is not set to none (or is not set at all) and you choose not to display the duration (see controls option).
invertTime Boolean true Display the current time as a countdown rather than an incremental counter.
toggleInvert Boolean true Allow users to click to toggle the above.
listeners Object null Allows binding of event listeners to the controls before the default handlers. See the defaults.js for available listeners. If your handler prevents default on the event (event.preventDefault()), the default handler will not fire.
captions Object { active: false, language: 'auto', update: false } active: Toggles if captions should be active by default. language: Sets the default language to load (if available). 'auto' uses the browser language. update: Listen to changes to tracks and update menu. This is needed for some streaming libraries, but can result in unselectable language options).
fullscreen Object { enabled: true, fallback: true, iosNative: false, container: null } enabled: Toggles whether fullscreen should be enabled. fallback: Allow fallback to a full-window solution (true/false/'force'). iosNative: whether to use native iOS fullscreen when entering fullscreen (no custom controls). container: A selector for an ancestor of the player element, allows contextual content to remain visual in fullscreen mode. Non-ancestors are ignored.
ratio String null Force an aspect ratio for all videos. The format is 'w:h' - e.g. '16:9' or '4:3'. If this is not specified then the default for HTML5 and Vimeo is to use the native resolution of the video. As dimensions are not available from YouTube via SDK, 16:9 is forced as a sensible default.
storage Object { enabled: true, key: 'plyr' } enabled: Allow use of local storage to store user settings. key: The key name to use.
speed Object { selected: 1, options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2] } selected: The default speed for playback. options: The speed options to display in the UI. YouTube and Vimeo will ignore any options outside of the 0.5-2 range, so options outside of this range will be hidden automatically.
quality Object { default: 576, options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240] } default is the default quality level (if it exists in your sources). options are the options to display. This is used to filter the available sources.
loop Object { active: false } active: Whether to loop the current video. If the loop attribute is present on a <video> or <audio> element, this will be automatically set to true This is an object to support future functionality.
ads Object { enabled: false, publisherId: '', tagUrl: '' } enabled: Whether to enable advertisements. publisherId: Your unique vi.ai publisher ID. tagUrl is a URL for a custom VAST tag if you're not using Vi.
urls Object See source. If you wish to override any API URLs then you can do so here. You can also set a custom download URL for the download button.
vimeo Object { byline: false, portrait: false, title: false, speed: true, transparent: false } See Vimeo embed options. Some are set automatically based on other config options, namely: loop, autoplay, muted, gesture, playsinline
youtube Object { noCookie: false, rel: 0, showinfo: 0, iv_load_policy: 3, modestbranding: 1 } See YouTube embed options. The only custom option is noCookie to use an alternative to YouTube that doesn't use cookies (useful for GDPR, etc). Some are set automatically based on other config options, namely: autoplay, hl, controls, disablekb, playsinline, cc_load_policy, cc_lang_pref, widget_referrer
previewThumbnails Object { enabled: false, src: '' } enabled: Whether to enable the preview thumbnails (they must be generated by you). src must be either a string or an array of strings representing URLs for the VTT files containing the image URL(s). Learn more about preview thumbnails below.
  1. Vimeo only
  2. Autoplay is generally not recommended as it is seen as a negative user experience. It is also disabled in many browsers. Before raising issues, do your homework. More info can be found here:

API

There are methods, setters and getters on a Plyr object.

Object

The easiest way to access the Plyr object is to set the return value from your call to the constructor to a variable. For example:

const player = new Plyr('#player', {
  /* options */
});

You can also access the object through any events:

element.addEventListener('ready', event => {
  const player = event.detail.plyr;
});

Methods

Example method use:

player.play(); // Start playback
player.fullscreen.enter(); // Enter fullscreen
Method Parameters Description
play()¹ - Start playback.
pause() - Pause playback.
togglePlay(toggle)¹ Boolean Toggle playback, if no parameters are passed, it will toggle based on current status.
stop() - Stop playback and reset to start.
restart() - Restart playback.
rewind(seekTime) Number Rewind playback by the specified seek time. If no parameter is passed, the default seek time will be used.
forward(seekTime) Number Fast forward by the specified seek time. If no parameter is passed, the default seek time will be used.
increaseVolume(step) Number Increase volume by the specified step. If no parameter is passed, the default step will be used.
decreaseVolume(step) Number Increase volume by the specified step. If no parameter is passed, the default step will be used.
toggleCaptions(toggle) Boolean Toggle captions display. If no parameter is passed, it will toggle based on current status.
fullscreen.enter() - Enter fullscreen. If fullscreen is not supported, a fallback "full window/viewport" is used instead.
fullscreen.exit() - Exit fullscreen.
fullscreen.toggle() - Toggle fullscreen.
airplay() - Trigger the airplay dialog on supported devices.
toggleControls(toggle) Boolean Toggle the controls (video only). Takes optional truthy value to force it on/off.
on(event, function) String, Function Add an event listener for the specified event.
once(event, function) String, Function Add an event listener for the specified event once.
off(event, function) String, Function Remove an event listener for the specified event.
supports(type) String Check support for a mime type.
destroy() - Destroy the instance and garbage collect any elements.
  1. For HTML5 players, play() will return a Promise for most browsers - e.g. Chrome, Firefox, Opera, Safari and Edge according to MDN at time of writing.

Getters and Setters

Example setters:

player.volume = 0.5; // Sets volume at 50%
player.currentTime = 10; // Seeks to 10 seconds

Example getters:

player.volume; // 0.5;
player.currentTime; // 10
player.fullscreen.active; // false;
Property Getter Setter Description
isHTML5 - Returns a boolean indicating if the current player is HTML5.
isEmbed - Returns a boolean indicating if the current player is an embedded player.
playing - Returns a boolean indicating if the current player is playing.
paused - Returns a boolean indicating if the current player is paused.
stopped - Returns a boolean indicating if the current player is stopped.
ended - Returns a boolean indicating if the current player has finished playback.
buffered - Returns a float between 0 and 1 indicating how much of the media is buffered
currentTime Gets or sets the currentTime for the player. The setter accepts a float in seconds.
seeking - Returns a boolean indicating if the current player is seeking.
duration - Returns the duration for the current media.
volume Gets or sets the volume for the player. The setter accepts a float between 0 and 1.
muted Gets or sets the muted state of the player. The setter accepts a boolean.
hasAudio - Returns a boolean indicating if the current media has an audio track.
speed Gets or sets the speed for the player. The setter accepts a value in the options specified in your config. Generally the minimum should be 0.5.
quality¹ Gets or sets the quality for the player. The setter accepts a value from the options specified in your config.
loop Gets or sets the current loop state of the player. The setter accepts a boolean.
source Gets or sets the current source for the player. The setter accepts an object. See source setter below for examples.
poster Gets or sets the current poster image for the player. The setter accepts a string; the URL for the updated poster image.
autoplay Gets or sets the autoplay state of the player. The setter accepts a boolean.
currentTrack Gets or sets the caption track by index. -1 means the track is missing or captions is not active
language Gets or sets the preferred captions language for the player. The setter accepts an ISO two-letter language code. Support for the languages is dependent on the captions you include. If your captions don't have any language data, or if you have multiple tracks with the same language, you may want to use currentTrack instead.
fullscreen.active - Returns a boolean indicating if the current player is in fullscreen mode.
fullscreen.enabled - Returns a boolean indicating if the current player has fullscreen enabled.
pip¹ Gets or sets the picture-in-picture state of the player. The setter accepts a boolean. This currently only supported on Safari 10+ (on MacOS Sierra+ and iOS 10+) and Chrome 70+.
ratio Gets or sets the video aspect ratio. The setter accepts a string in the same format as the ratio option.
download Gets or sets the URL for the download button. The setter accepts a string containing a valid absolute URL.
  1. HTML5 only

The .source setter

This allows changing the player source and type on the fly.

Video example:

player.source = {
  type: 'video',
  title: 'Example title',
  sources: [
    {
      src: '/path/to/movie.mp4',
      type: 'video/mp4',
      size: 720,
    },
    {
      src: '/path/to/movie.webm',
      type: 'video/webm',
      size: 1080,
    },
  ],
  poster: '/path/to/poster.jpg',
  previewThumbnails: {
    src: '/path/to/thumbnails.vtt',
  },
  tracks: [
    {
      kind: 'captions',
      label: 'English',
      srclang: 'en',
      src: '/path/to/captions.en.vtt',
      default: true,
    },
    {
      kind: 'captions',
      label: 'French',
      srclang: 'fr',
      src: '/path/to/captions.fr.vtt',
    },
  ],
};

Audio example:

player.source = {
  type: 'audio',
  title: 'Example title',
  sources: [
    {
      src: '/path/to/audio.mp3',
      type: 'audio/mp3',
    },
    {
      src: '/path/to/audio.ogg',
      type: 'audio/ogg',
    },
  ],
};

YouTube example:

player.source = {
  type: 'video',
  sources: [
    {
      src: 'bTqVqk7FSmY',
      provider: 'youtube',
    },
  ],
};

Vimeo example

player.source = {
  type: 'video',
  sources: [
    {
      src: '143418951',
      provider: 'vimeo',
    },
  ],
};

Note: src property for YouTube and Vimeo can either be the video ID or the whole URL.

Property Type Description
type String Either video or audio. Note: YouTube and Vimeo are currently not supported as audio sources.
title String Optional. Title of the new media. Used for the aria-label attribute on the play button, and outer container. YouTube and Vimeo are populated automatically.
sources Array This is an array of sources. For HTML5 media, the properties of this object are mapped directly to HTML attributes so more can be added to the object if required.
poster¹ String The URL for the poster image (HTML5 video only).
tracks¹ String An array of track objects. Each element in the array is mapped directly to a track element and any keys mapped directly to HTML attributes so as in the example above, it will render as <track kind="captions" label="English" srclang="en" src="https://cdn.selz.com/plyr/1.0/example_captions_en.vtt" default> and similar for the French version. Booleans are converted to HTML5 value-less attributes.
previewThumbnails¹ Object The same object like in the previewThumbnails constructor option. This means you can either change the thumbnails vtt via the src key or disable the thumbnails plugin for the next video by passing { enabled: false }.
  1. HTML5 only

Events

You can listen for events on the target element you setup Plyr on (see example under the table). Some events only apply to HTML5 audio and video. Using your reference to the instance, you can use the on() API method or addEventListener(). Access to the API can be obtained this way through the event.detail.plyr property. Here's an example:

player.on('ready', event => {
  const instance = event.detail.plyr;
});

Standard Media Events

Event Type Description
progress Sent periodically to inform interested parties of progress downloading the media. Information about the current amount of the media that has been downloaded is available in the media element's buffered attribute.
playing Sent when the media begins to play (either for the first time, after having been paused, or after ending and then restarting).
play Sent when playback of the media starts after having been paused; that is, when playback is resumed after a prior pause event.
pause Sent when playback is paused.
timeupdate The time indicated by the element's currentTime attribute has changed.
volumechange Sent when the audio volume changes (both when the volume is set and when the muted state is changed).
seeking Sent when a seek operation begins.
seeked Sent when a seek operation completes.
ratechange Sent when the playback speed changes.
ended Sent when playback completes. Note: This does not fire if autoplay is true.
enterfullscreen Sent when the player enters fullscreen mode (either the proper fullscreen or full-window fallback for older browsers).
exitfullscreen Sent when the player exits fullscreen mode.
captionsenabled Sent when captions are enabled.
captionsdisabled Sent when captions are disabled.
languagechange Sent when the caption language is changed.
controlshidden Sent when the controls are hidden.
controlsshown Sent when the controls are shown.
ready Triggered when the instance is ready for API calls.

HTML5 only

Event Type Description
loadstart Sent when loading of the media begins.
loadeddata The first frame of the media has finished loading.
loadedmetadata The media's metadata has finished loading; all attributes now contain as much useful information as they're going to.
qualitychange The quality of playback has changed.
canplay Sent when enough data is available that the media can be played, at least for a couple of frames. This corresponds to the HAVE_ENOUGH_DATA readyState.
canplaythrough Sent when the ready state changes to CAN_PLAY_THROUGH, indicating that the entire media can be played without interruption, assuming the download rate remains at least at the current level. Note: Manually setting the currentTime will eventually fire a canplaythrough event in firefox. Other browsers might not fire this event.
stalled Sent when the user agent is trying to fetch media data, but data is unexpectedly not forthcoming.
waiting Sent when the requested operation (such as playback) is delayed pending the completion of another operation (such as a seek).
emptied he media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it.
cuechange Sent when a TextTrack has changed the currently displaying cues.
error Sent when an error occurs. The element's error attribute contains more information.

YouTube only

Event Type Description
statechange The state of the player has changed. The code can be accessed via event.detail.code. Possible values are -1: Unstarted, 0: Ended, 1: Playing, 2: Paused, 3: Buffering, 5: Video cued. See the YouTube Docs for more information.

Note: These events also bubble up the DOM. The event target will be the container element.

Some event details borrowed from MDN.

Embeds

YouTube and Vimeo are currently supported and function much like a HTML5 video. Similar events and API methods are available for all types. However if you wish to access the API's directly. You can do so via the embed property of your player object - e.g. player.embed. You can then use the relevant methods from the third party APIs. More info on the respective API's here:

Note: Not all API methods may work 100%. Your mileage may vary. It's better to use the Plyr API where possible.

Shortcuts

By default, a player will bind the following keyboard shortcuts when it has focus. If you have the global option to true and there's only one player in the document then the shortcuts will work when any element has focus, apart from an element that requires input.

Key Action
0 to 9 Seek from 0 to 90% respectively
space Toggle playback
K Toggle playback
Seek backward by the seekTime option
Seek forward by the seekTime option
Increase volume
Decrease volume
M Toggle mute
F Toggle fullscreen
C Toggle captions
L Toggle loop

Preview thumbnails

It's possible to display preview thumbnails as per the demo when you hover over the scrubber or while you are scrubbing in the main video area. This can be used for all video types but is easiest with HTML5 of course. You will need to generate the sprite or images yourself. This is possible using something like AWS transcoder to generate the frames and then combine them into a sprite image. Sprites are recommended for performance reasons - they will be much faster to download and easier to compress into a small file size making them load faster.

You can see the example VTT files here and here for how the sprites are done. The coordinates are set as the xywh hash on the URL in the order X Offset, Y Offset, Width, Height (e.g. 240p-00001.jpg#xywh=1708,480,427,240 is offset 1708px from the left, 480px from the top and is 427x240px. If you want to include images per frame, this is also possible but will be slower, resulting in a degraded experience.

Fullscreen

Fullscreen in Plyr is supported by all browsers that currently support it.

Browser support

Plyr supports the last 2 versions of most modern browsers.

Browser Supported
Safari
Mobile Safari ✓¹
Firefox
Chrome
Opera
Edge
IE11 ✓³
IE10 2,3
  1. Mobile Safari on the iPhone forces the native player for <video> unless the playsinline attribute is present. Volume controls are also disabled as they are handled device wide.
  2. Native player used (no support for <progress> or <input type="range">) but the API is supported. No native fullscreen support, fallback can be used (see options).
  3. Polyfills required. See below.

Polyfills

Plyr uses ES6 which isn't supported in all browsers quite yet. This means some features will need to be polyfilled to be available otherwise you'll run into issues. We've elected to not burden the ~90% of users that do support these features with extra JS and instead leave polyfilling to you to work out based on your needs. The easiest method I've found is to use polyfill.io which provides polyfills based on user agent. This is the method the demo uses.

Checking for support

You can use the static method to check for support. For example

const supported = Plyr.supported('video', 'html5', true);

The arguments are:

  • Media type (audio or video)
  • Provider (html5, youtube or vimeo)
  • Whether the player has the playsinline attribute (only applicable to iOS 10+)

Disable support programmatically

The enabled option can be used to disable certain User Agents. For example, if you don't want to use Plyr for smartphones, you could use:

{
  enabled: !/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
}

If a User Agent is disabled but supports <video> and <audio> natively, it will use the native player.

Plugins & Components

Some awesome folks have made plugins for CMSs and Components for JavaScript frameworks:

Type Maintainer Link
WordPress Brandon Lavigne (@drrobotnik) https://wordpress.org/plugins/plyr/
Angular Simon Bobrov (@smnbbrv) https://github.com/smnbbrv/ngx-plyr
React Chintan Prajapati (@chintan9) https://github.com/chintan9/plyr-react
Vue Gabe Dunn (@redxtech) https://github.com/redxtech/vue-plyr
Neos Jon Uhlmann (@jonnitto) https://packagist.org/packages/jonnitto/plyr
Kirby Dominik Pschenitschni (@dpschen) https://github.com/dpschen/kirby-plyrtag
REDAXO FriendsOfRedaxo / skerbis (@skerbis) https://github.com/FriendsOfREDAXO/plyr
svelte-plyr Ben Woodward / benwoodward (@benwoodward) https://github.com/benwoodward

Issues

If you find anything weird with Plyr, please let us know using the GitHub issues tracker.

Author

Plyr is developed by @sam_potts / sampotts.me with help from the awesome contributors

Donate

Plyr costs money to run, not only my time. I donate my time for free as I enjoy building Plyr but unfortunately have to pay for domains, hosting, and more. Any help with costs is appreciated...

Mentions

Used by

If you want to be added to the list, open a pull request. It'd be awesome to see how you're using Plyr 😎

Useful links and credits

Thanks

Fastly

Massive thanks to Fastly for providing the CDN services.

Sentry

Massive thanks to Sentry for providing the logging services for the demo site.

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

Copyright and License

The MIT license

Comments
  • Aspect ratio?

    Aspect ratio?

    How do you specify height/width, or at least an aspect ratio? It seems to force a default aspect ratio, which can cut things off that don't conform. This cropping exists in full screen, too (at least from Firefox).

    Specifically, I'm using a Vimeo embed (the empty div method).

    opened by danicholls 41
  • *Announcement*: v3 beta testing

    *Announcement*: v3 beta testing

    Hey,

    I'm happy to say that the illusive v3 is now available for beta testing. I'm sorry it's taken so long but it turned into a full blown re-write in the end. The changelog is massive as you can imagine and there's quite a few breaking changes. The docs are also updated.

    It also includes an ads plugin (in partnership with https://vi.ai) which we are in the final stages of finalising. It's currently undocumented but once we're happy with it then it'll be documented and publicised accordingly.

    If you find any bugs then please prefix them with [v3] so I know it's the new version. Once all testing is complete and bugs fixed, then it'll go to master.

    There's a preview up here: https://plyr.io/beta

    Also, if you have any questions, feel free to duck into the slack workspace

    Cheers Sam

    opened by sampotts 38
  • YouTube autoplay broken in >= 3.3.8

    YouTube autoplay broken in >= 3.3.8

    Expected behaviour

    Plyr should autoplay when the correct options are passed to the constructor.

    Actual behaviour

    Video loads, but doesn't autoplay.

    Steps to reproduce

    Using the Codepen template, pass autoplay=true, muted=true, and volume=0 (links below)

    Environment

    • Browser: Chrome 69, Firefox 62
    • Operating System: MacOS
    • Version: 10.13.6

    Console errors (if any)

    Link to where the bug is happening

    Not working: https://codepen.io/anon/pen/KxZOqM (latest) Not working: https://codepen.io/anon/pen/GXyVmL (v 3.3.8) Working: https://codepen.io/anon/pen/aaEeWE (v 3.3.7)

    opened by jryom 32
  • Suggestion: add download button inside the player control bar

    Suggestion: add download button inside the player control bar

    When the user click the download icon, they'll download the video straight away into their computer.

    If the video is coming from YouTube or Vimeo, we need to think about that so that user can download them too.

    Feature In Development 
    opened by zulhfreelancer 29
  • Vimeo controls displaying behing Plyr controls

    Vimeo controls displaying behing Plyr controls

    Issue is visible on plyr.io website (https://plyr.io/#vimeo)

    Expected behaviour

    Plyr controls should only be visible

    Actual behaviour

    Both Vimeo and Plyr controls are visible

    Environment

    • Browser: Chrome (latest)
    • Version: Plyr 2.0.16

    Players affected:

    • Vimeo

    Steps to reproduce

    • Embed Vimeo as per docs

    Relevant links

    https://plyr.io/#vimeo

    opened by lukeyouell 27
  • Seek-Preview

    Seek-Preview

    I want to add something like YouTube has for quite some time now, I want you to add a Seek-Preview for me like on YouTube, because I am recently quite interested in dtube project but the player pisses me so... here is my thing to ask if it is possible:

    We have this Preview Image, Prerendered: https://ipfs.io/ipfs/QmaJNsdbT2jARQYSmNJuNhCQucLiTmWGookzCFjjSpzpLq

    and this is the thing I want: image

    thanks in advance. Sorry for my English.

    opened by calvinthefreak 24
  • Vimeo videos not playing with chrome desktop Version 89.0

    Vimeo videos not playing with chrome desktop Version 89.0

    Hi, getting a strange issue with plyr.js with vimeo videos .Videos are just start playing and then paused . Here is the video of the issue : http://somup.com/creIh7bjgh

    html : <div id="'item_1" data-plyr-provider="vimeo" data-plyr-embed-id="502425852"></div>

    script : `let config = {}; config['listeners']={ seek: (e) => { var currentTime = plyr.currentTime; var newTime = _getTargetTime(plyr, e); if (newTime > currentTime) { e.preventDefault();

    		    return false;
    		  }
    	}
    

    };

    let pplayer = new Plyr(document.querySelector('#item_1'),config);`

    Environment

    • Browser:Chrome
    • Version:89.0
    • Operating System:MacOS
    • Version:High Siera

    Errors in console : Unrecognized feature: 'autoplay,fullscreen,picture-in-picture'. ------ plyr.js?ver=2009:formatted:3414

    Uncaught TypeError: this.enter is not a function ---- plyr.js?ver=2009:formatted:2547

    Update

    this is happening with your own demo : https://codepen.io/pen?template=bKeXNq

    opened by alexvibealex 22
  • https://vimeo.com/api/v2/video/{id}.json not found

    https://vimeo.com/api/v2/video/{id}.json not found

    Expected behaviour

    No error logged in the console.

    Actual behaviour

    An error is displayed in the console with a response of "{id} not found."

    Steps to reproduce

    Follow the Vimeo steps and embed a video.

    Environment

    • Browser: Chrome
    • Version: 68
    • Operating System: MacOS
    • Version: 10.13.6
    opened by stanvanheumen 22
  • Fullscreen on iPad

    Fullscreen on iPad

    • [x] Issue does not already exist
    • [ ] Issue observed on https://plyr.io

    Expected behaviour

    I've implemented toggleFullscreen(); on my video, and it works fine on desktop (and iPhone, but because of its native handling of videos, not because of my code). I would expect the desktop behaviour to work on an iPad as well.

    Actual behaviour

    On an iPad, the video stays inline and doesn't open in fullscreen.

    Environment

    • Browser: iOS Safari
    • Version: -
    • Operating System: iOS (iPad)
    • Version: 11.2.5

    Players affected:

    • [x] HTML5 Video
    • [ ] HTML5 Audio
    • [x] YouTube
    • [x] Vimeo

    Steps to reproduce

    • Click play to toggle fullscreen and start video

    Relevant links

    My codepen: https://codepen.io/shainanigans-1472169587/pen/eVOxRQ

    opened by shainanigans 22
  • Problems with multiple YouTube embeds in the same page.

    Problems with multiple YouTube embeds in the same page.

    If there are 2 or more from YouTube on the same page, neither of them will work properly: the seek bar will not move, and the play button will never go away.

    image

    For plyr, it's like the video never starts playing, but it is!

    Also, as seen on the screenshot, the buffer bar still works properly, as well as pretty much everything else.

    Tested on Chrome 54.0.2791.0 (Canary) and Firefox 49.0a2

    Bug 
    opened by TheBITLINK 21
  • Plyr + React

    Plyr + React

    Hi folks! The player looks great - thank you for your work on this.

    I am not sure if this is appropriate to create an issue for (so feel free to close it) but I was curious if anyone has made this work in the React world and/or if there are things/gotchas to be aware of while integrating? I am trying to assess if this would work in an existing project which currently just uses native HTML5 players.

    opened by oyeanuj 21
  • LBRY Support & Peertube Support

    LBRY Support & Peertube Support

    Please allow for built in easy integration with LBRY and Peertube just as there is built in easy integration with YouTube and Vimeo.

    LBRY is a decentralised platform for videos and audio. And uses links such as...

    lbry://@samtime:1/why-i-still-use-a-blackberry-in-2022:a

    Peertube is a federated platform for videos and audio. Anyone can host their own Peertube instance. Here a video from the Framatube instance.

    https://framatube.org/w/9dRFC6Ya11NCVeYKn8ZhiD

    opened by trymeouteh 0
  • iPhone not autoplay and play button trigger

    iPhone not autoplay and play button trigger

    There is no problem on the computer. But the video does not autoplay on the phone. It remains as pictured. Picture: https://ibb.co/9r3c1Gt

    Expected behaviour

    Autoplay of video

    Actual behaviour

    It stays as pictured.

    Steps to reproduce

    Environment

    HTML:

    <div id="tungaloy-video">
            <video id="player" autoplay loop muted playsinline>
                <source src="https://www.nokmuhendislik.com/beta/assets/video/tungaloy.mp4" type="video/mp4"/>
            </video>
    </div>
    

    JS

    const selector = '#player';
            const player = new Plyr(selector, {
                debug: true,
                controls: false,
                volume: 0,
                muted: true,
                autoplay: true,
                loop: {
                    active: true
                },
    
            });
            player.muted=true;
            player.play();
            // Expose for tinkering in the console
            window.player = player;
    
    • Browser: Safari / Chrome
    • Version: iOS 16.0
    • Operating System: iOS 16.0
    • Version: iPhone XS

    Console errors (if any)

    Link to where the bug is happening

    nokmuhendislik.com/beta

    opened by semih-nokgrup 0
  • the controls can't be over written

    the controls can't be over written

    Html Code `

        <video preload="none" id="player" controls data-plyr-config='{ "controls": ['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'settings', 'pip', 'fullscreen'] }'></video>
    
        <div class="data">
    
            <p id="status">Status: {{data[1]}}</p>
    
        <p id="total-ep">Total Episodes: {{data[4]}}</p>
    
        </div>
    
    </div>
    
     <script src="https://cdn.plyr.io/1.8.2/plyr.js"></script>
    
     <script src="https://cdn.jsdelivr.net/hls.js/latest/hls.js"></script>
    

    `

    js Code `

       (function () {
    
        var video = document.querySelector('#player');
    
        if (Hls.isSupported()) {
    
            var hls = new Hls();
    
            hls.loadSource("{{eplink}}");
    
            hls.attachMedia(video);
    
            hls.on(Hls.Events.MANIFEST_PARSED, function () {
    
                video.play();
    
            });
    
        }
    
        plyr.setup(video);
    
    })();
    

    `

    using this code i cant overwrite the controls no matter what please anyone with the solution

    opened by Shuvadip-Ghosh 0
  • TypeError: Cannot set properties of undefined (setting 'muted')

    TypeError: Cannot set properties of undefined (setting 'muted')

    Environment

    • Browser: Chrome
    • Version: 3.7.3
    • Operating System: macOS Monterey
    • Version: 12.4

    Console errors (if any)

    TypeError: Cannot set properties of undefined (setting 'muted')

    Screenshot 2022-12-23 at 11 50 17 AM Screenshot 2022-12-23 at 11 50 03 AM
    opened by DNDeveloper-s 0
  • Adding custom setting

    Adding custom setting

    I'd like to add a custom option to the settings that will set a variable value

    For the sake of the argument, let's say it's theme, with the options: light, dark and blue

    It will open up the regular settings options with Theme listed and 'Light' as the default value

    When the options are opened it shows Light Dark Blue

    with the back button.

    Then when one of the buttons are clicked, there is an event where I set the variable value, let's say themeValue='dark'

    I thought this would be simple to do but can't find any documentation or working examples. Is this possible/documented anywhere? Thanks

    opened by mayeaux 0
Releases(v3.7.3)
  • v3.7.3(Nov 17, 2022)

    • Fix: force nowrap in progress tooltips (related: #2549) (thanks @raad-altaie!)
    • Feat(i18n): Make captions autodetect text direction (#2540) (thanks @ebraminio!)
    • Fix: fixed menu border radius bug (#2548) (thanks @raad-altaie!)
    • Chore: navigator.platform is deprecated (#2530) (thanks @stamat!)
    • Feat: Added configurable property to elements for re-use (#2489) (thanks @NoirHusky!)
    • Docs: Replace example video ID with one that still works (#2518) (thanks @luvejo!)
    • Fix: Improve accessibility on control buttons with aria-pressed (#2523) (thanks @emilkarl!)
    • Fix: Fix for calc() in newer Dart Sass versions (#2519) (thanks @ckhicks!)
    • Fix: simplify logic for isFunction assertion method
    • Chore: update types to include string for controls
    • Chore: upgrade packages
    • Chore: use .node-version instead of .nvmrc
    Source code(tar.gz)
    Source code(zip)
  • v3.7.2(Apr 20, 2022)

  • v3.7.1(Apr 20, 2022)

    • Feat: Minor styling improvements to the preview thumbnails (🚨 Requires a SCSS/CSS update 🚨)
    • Fix: fix invalid CSS @charset rule in Sass files (thanks @Hashen110!)
    • Chore: Replace deprecated KeyboardEvent keyCode references to use key instead (thanks @Hashen110!)
    • Various other code clean up and typo fixes (thanks @Hashen110!)
    Source code(tar.gz)
    Source code(zip)
  • v3.7.0(Apr 18, 2022)

    • Feat: Add markers support (🚨 Requires a SCSS/CSS update 🚨) (thanks @ForeverSc and @fengshuo!)
    • Feat: Add support for MediaMetadata (thanks @Hashen110!)
    • Fix: Pass this context to captions.setup (fixes #2352) (thanks @WilliamMHerring, @willherring and @zenyr!)
    • Fix: Modify vimeo parseHash to use non-named capture groups (fixes #2396) (thanks @fekle!)
    • Fix: Replace deprecated String.prototype.substr() (thanks @CommanderRoot!)
    • Docs: Update speed option default to match the source (thanks @ozgurg!)
    • Docs: SASS → Sass (thanks @toastal!)
    Source code(tar.gz)
    Source code(zip)
  • v3.6.12(Dec 16, 2021)

  • v3.6.11(Dec 16, 2021)

  • v3.6.10(Dec 16, 2021)

  • v3.6.9(Oct 13, 2021)

    • Fix: SASS issue with division (thanks @ROL4ND909 and @le0pard)
    • Fix: Captions when switching sources (thanks @zexingguo)
    • Fix: Icons loading within iframes (thanks @ajgagnon)
    • Chore: Update TypeScript types (thanks @Jackie1210 and @AntLevin)
    • Fix: iOS fullscreen centering (thanks @hemratna)
    • Feat: Added getter and setter for preview thumbnails (thanks @Benny739)
    • Fix: Change fullscreen element to player rootnode (thanks @Walter van den Houten)
    • Fix: Fixed errors when Plyr instance is destroyed before constructor setTimeout() functions execute (thanks @emilis-ideait)
    • Fix: Invalid CSS selector syntax (thanks @BjornBrandewallNaviga)
    • Fix: Video height issues
    • Feat: Improve support for Vimeo private videos (thanks @Frosch)
    • Fix: YouTube duration issues (thanks @liesahead)
    Source code(tar.gz)
    Source code(zip)
  • v3.6.8(May 12, 2021)

    • Typings: add FullscreenOptions.container to typing files (thanks @MeguminSama!)
    • Fix: added iPadOS detection to isIos util (thanks @Benny739!)
    • Fix: issues with Vimeo fullscreen
    Source code(tar.gz)
    Source code(zip)
  • v3.6.7(Apr 20, 2021)

  • v3.6.6(Apr 18, 2021)

    • Improvements to how aspect ratio is handled. Use aspect-ratio CSS property instead of the legacy method (still used as fallback). Also automatically determined aspect ratios are rounded to the nearast standard ratio. This fixes issues with the YouTube embeds showing a 1-2px black bar.
    • Hide the YouTube poster image container when paused so that the controls underneath can be used.
    Source code(tar.gz)
    Source code(zip)
  • v3.6.5(Apr 16, 2021)

    • Migrate color formatting to colorette (thanks @jorgebucaran)
    • Fix: issue with IE detection
    • Fix: missing styles for embeds
    • Fix: regression regarding poster image
    • Add all required props to vimeo iframe allow attribute - fixes #2151 (thanks @didrip)
    Source code(tar.gz)
    Source code(zip)
  • v3.6.4(Mar 16, 2021)

    • Remove unnecessary calc from media query (thanks @naomiaz)
    • Enhance types (thanks @lunika)
    • Fix: Object.values for the providers must be used (thanks @syteknet-core)
    • Fix: Improve support inside iframes (thanks @ajgagnon)
    • Added --plyr-video-background for having control over the background of a video with alpha channel (webm) or a poster image with alpha channel (thanks @nepomuc)
    • Fix issue with not entering iosfullscreen of vimeo videos with playsinline=true (thanks @lordon and @Frosch)
    • fix: use new syntax for iframe allow attribute
    • chore: package updates
    • chore: add @babel/plugin-proposal-class-properties
    • fix: use bound arrow functions in classes
    Source code(tar.gz)
    Source code(zip)
  • v3.6.3(Nov 14, 2020)

    • Fix volume when unmuting from volume 0 using YouTube (thanks @stephanefbouchard)
    • Add missing unit to calc in media query (thanks @vincentorback)
    • Assigning player's lastSeekTime on rewind/fast forward to prevent immediate controls hide on mobile (thanks @trafium)
    • Fix for volume control overflowing in Firefox (thanks @dirkjf)
    • Force fullscreen events to trigger on plyr element (media element in iOS) and not fullscreen container (thanks @theprojectsomething)
    • TypeScript types improvements (thanks @akuma06 & @iwatakeshi)
    • Dash demo link fixed (thanks @jonathanarbely)
    • Fix "A ReferenceError: _classCallCheck is not defined error has occurred." error (thanks @hex-ci)
    • Fix issue with CSS custom property check (thanks @syedhusain-appspace)
    • Fix for slow loading videos not autoplaying (thanks @DanielHuntleySBG)
    • Fix for betwork requests are not cancelled after the player is destroyed (thanks @DanielHuntleySBG)
    • Added option to disable custom controls for YouTube and Vimeo
    Source code(tar.gz)
    Source code(zip)
  • v3.6.2(May 4, 2020)

    • Fixes for CSS Custom Property related errors in some build tools (thanks @Bashev)
    • Fixes for custom controls as element (thanks @taylorchu)
    • Added missing TypeScript interface for preview thumbnail options (thanks @taylorchu)
    Source code(tar.gz)
    Source code(zip)
  • v3.6.1(Apr 28, 2020)

    • You can now easily change colors using CSS Custom Properties. See the README.
    • Bug fix for Vimeo fullscreen.
    • Various typos (thanks @likev)
    • Preload TextTracks as per default video element (thanks @theprojectsomething)
    • Features/fullscreen container (thanks @theprojectsomething)
    • Ignore internal play promises (thanks @ydylla)
    • Ads plugin fixes to allow multiple VAST requests (thanks @Steejo)
    • Fix shadowroot (thanks @jnoordsij)
    • Add financial contributors for Open Collective (thanks @monkeywithacupcake)
    • Update the gitpod setup description to be more precise. (thanks @nisarhassan12)
    • Completely hide SVG icons to screen readers (thanks @LeBenLeBen)
    • Preview thumbnails via src:callback() (thanks @doublex)
    • Add missing Typescripts types and options (thanks @hug963)
    • Use number instead of string in TS quality definitions (thanks @mogzol)
    • Fix Vimeo playback rate (thanks @hug963)
    • Fix issue when controls config is string or element (thanks @CzBiX)
    • Simplify contributions by fully automating the dev setup with gitpod (thanks @nisarhassan12)
    • Safari bug fix for regression in previous release
    Source code(tar.gz)
    Source code(zip)
  • v3.5.10(Feb 14, 2020)

  • v3.5.9(Feb 14, 2020)

  • v3.5.8(Feb 10, 2020)

    • Added flex-direction property to fix some issues introduced in v3.5.7 when using custom CSS
    • Cleaned up the organisation of some of the SCSS files (should not effect CSS output)
    • Added referrerPolicy option for Vimeo to prevent an issue present in the demo site
    • Remove all Vimeo controls for Pro & Premium accounts
    • Improve thumbnail size calculations when size is set per css (thanks @ydylla)
    • Add previewThumbnails source setter (thanks @ydylla)
    • More speed setting logic improvements
    Source code(tar.gz)
    Source code(zip)
  • v3.5.7(Feb 9, 2020)

    • Typescript typings (thanks @ondratra)
    • togglePlay now also returns a Promise (thanks @azizhk)
    • Documentation improvements and typo fixes (thanks @ffpetrovic, @skerbis, @ayunami2000, @pjbaert, @MaxGiting, @0xflotus and @thatrobotdev)
    • Accessibility tweak for the play button (thanks @lunika)
    • Fix for ads configuration (thanks @SoftCreatR)
    • Fix handling listener return value (thanks @taion)
    • Added localisation key for PIP (picture-in-picture) (thanks @lmislm)
    • Preserve viewBox attribute in SVG sprite symbols (thanks @bseib)
    • Fix being unable to unmute autoplayed video on iOS (thanks @sumanbh)
    • Fixed Plyr container not resizing responsively (thanks @shravan2x)
    • Change vimeo demo video (thanks @thatrobotdev)
    • Fix for Uncaught RangeError: Maximum call stack size exceeded (thanks @laukstein)
    • Improve fullscreen experience on some devices (thanks @savroff)
    • Improvements to buffering state for embedded players (thanks @doostinharrell)
    • Prevents IE11 with resetOnEnd option set to true to play video again (thanks @Felipe K. De Boni)
    • Fix for multiple poster image downloads (use the native poster only for HTML5 videos)
    • Various presentational fixes
    • Removed logic to hide/show volume controls based on audio track detection due to it's problematic nature. If you want to hide volume control, use the controls option to do so.
    • Fix preview thumbnail scrubbing not working on mobile touch devices (thanks @ydylla)
    • Add download attribute to download button (thanks @Code1110)
    • Trap keyboard focus only when fullscreen (thanks @k-jensen)
    • Improvements to speed options - you can now specify all options in the UI (YouTube and Vimeo only accept 0.5-2) (thanks @ydylla)
    • Improve/fix quality change state restoring (thanks @ydylla)

    Note: This update contains CSS changes.

    Source code(tar.gz)
    Source code(zip)
  • v3.5.4(Apr 25, 2019)

    • Added: Set download URL via new setter
    • Improvement: The order of the controls option now effects the order in the DOM - i.e. you can re-order the controls - Note: this may break any custom CSS you have setup. Please see the changes in the PR to the default SASS
    • Fixed issue with empty controls and preview thumbs
    • Fixed issue with setGutter call (from Sentry)
    • Fixed issue with initial selected speed not working
    • Added notes on autoplay config option and browser compatibility
    • Fixed issue with ads volume not matching current content volume
    • Fixed race condition where ads were loading during source change
    • Improvement: Automatic aspect ratio for YouTube is now supported, meaning all aspect ratios are set based on media content - Note: we're now using a different API to get YouTube video metadata so you may need to adjust any CSPs you have setup
    • Fix for menu in the Shadow DOM (thanks @emielbeinema)
    Source code(tar.gz)
    Source code(zip)
  • v3.5.3(Apr 12, 2019)

    • Improved the usage of the ratio config option; it now works as expected and for all video types. The default has not changed, it is to dynamically, where possible (except YouTube where 16:9 is used) determine the ratio from the media source so this is not a breaking change.
    • Added new ratio getter and setter
    • Fix: Properly clear all timeouts on destroy
    • Fix: Allow absolute paths in preview thumbnails
    • Improvement: Allow optional hours and ms in VTT parser in preview thumbnails
    Source code(tar.gz)
    Source code(zip)
  • v3.5.1(Feb 23, 2019)

  • v3.5.0(Feb 18, 2019)

    • Preview seek/scrubbing thumbnails (thanks @jamesoflol)
    • Fixes for proxy listeners (thanks @gurupras)
    • Fix for buffer progress transition on WebKit (thanks @samuelgozi)
    • Fix for error when mime type not specified (fixes #1274)
    • Support YouTube noCookie (thanks Omar Khatib)
    • Add Angular plugin reference (thanks @smnbbrv)
    • Use Math.trunc instead of parseInt (thanks @taion)
    • Many fixes for fullscreen in embedded players with non 16:9 screens or videos
    • Added 'force' fallback option for fullscreen
    • RangeTouch is now bundled with Plyr as a dependency to fix the scrubber on touch devices
    Source code(tar.gz)
    Source code(zip)
  • v3.4.5(Oct 24, 2018)

    • Added download button option to download either current source or a custom URL you specify in options
    • Prevent immediate hiding of controls on mobile (thanks @jamesoflol)
    • Don't hide controls on focusout event (fixes #1122) (thanks @jamesoflol)
    • Fix HTML5 quality settings being incorrectly set in local storage (thanks @TechGuard)
    Source code(tar.gz)
    Source code(zip)
  • v3.4.0(Aug 13, 2018)

    • Accessibility improvements (see #905)
    • Improvements to the way the controls work on iOS
    • Demo code clean up
    • YouTube quality selection removed due to their poor support for it. As a result, the qualityrequested event has been removed
    • Controls spacing improvements
    • Fix for pressed property missing with custom controls (Fixes #1062)
    • Fix #1153: Captions language fallback (thanks @friday)
    • Fix for setting pressed property of undefined (Fixes #1102)
    Source code(tar.gz)
    Source code(zip)
  • v3.2.0(Apr 17, 2018)

    • Fullscreen fixes (thanks @friday)
    • Menu fix for if speed not in config
    • Menu z-index fix (thanks @danielsarin)
    • i18n fix for missing "Normal" string (thanks @danielsarin)
    • Safer check for active caption (thanks @Antonio-Laguna)
    • Add custom property fallback (thanks @friday)
    • Fixed bug for captions with no srclang and labels and improved logic (fixes #875)
    • Fix for playing false positive (fixes #898)
    • Fix for IE issue with navigator.language (thanks @nicolasthy) (fixes #893)
    • Fix for Vimeo controls missing on iOS (thanks @verde-io) (fixes #807)
    • Fix for double vimeo caption rendering (fixes #877)
    Source code(tar.gz)
    Source code(zip)
  • v3.1.0(Apr 10, 2018)

  • v3.0.3(Mar 21, 2018)

    • Vimeo offset tweak (fixes #826)
    • Fix for .stop() method (fixes #819)
    • Check for array for speed options (fixes #817)
    • Restore as float (fixes #828)
    • Fix for Firefox fullscreen oddness (Fixes #821)
    • Improve Sprite checking (fixes #827)
    • Fix fast-forward control (thanks @saadshahd)
    • Fix the options link in the readme (thanks @DanielRuf)
    Source code(tar.gz)
    Source code(zip)
  • v3.0.0(Mar 17, 2018)

    This is a massive release. A mostly complete rewrite in ES6. What started out as a few changes quickly snowballed. There's many breaking changes so be careful upgrading.

    Big changes

    • New settings menu complete with funky animations
    • Ability to adjust speed of playback
    • Ability to toggle caption language (HTML5 and Vimeo only)
    • Ability to set YouTube quality (HTML5 will follow)
    • Added support for Vimeo captions
    • Added Picture-in-Picture support (Safari only)
    • Added AirPlay support (again, Safari only)
    • Added playsinline support for iOS 10+
    • Soundcloud removed until I can work on a plugin framework
    • Embedded players are now progressively enhanced - no more empty <div>s!

    Other stuff

    • Now using SASS exclusively. Sorry, LESS folk it just made sense to maintain one method as SASS is what the cool kids use. It may come back if we work out an automated way to convert the SASS
    • Moved to ES6. All the rage these days. You'll need to look at polyfills. The demo uses polyfill.io
    • Added basic looping support
    • Added an aspect ratio option for those that can't leave the 90s and want 4:3
    • controlshidden and controlsshown events added for when the controls show or hide
    • qualityrequested and qualitychange events for YouTube quality control (HTML5 will follow)
    • Volume is now 0 to 1 as per HTML5 spec
    • No longer bodging a <progress> behind the <input type="range"> to make up for WebKit's lack of lower fill styling
    • Captions now render with line breaks as intended
    • Captions now render without AJAX using the native events etc
    • Added a fallback for getting YouTube video data incase .getVideoData() disappears when one of their developers randomly deletes it again
    • Setup and building of the UI should be way "snappier"
    • Click to toggle inverted time (e.g. 0:01 or -2:59 for a 3 minute video at 1 seconds) - new toggleInvert and invertTime options
    • Added autopause option for Vimeo
    • Added muted option for you guessed it, muted playback
    • Restored the .off() API method
    • .play() will now return a promise to prevent that pesky uncaught promise issue in Chrome etc
    • Pressing and hold the seek bar no longer freezes all other updates of the UI

    ...plus loads of bug fixes.

    Breaking changes

    You gotta break eggs to make an omelette. Sadly, there's quite a few breaking changes:

    • Setup now uses proper constructor, accepts a single selector/element/node and returns a single instance - much simpler than before
    • Much of the API is now using getters and setters rather than methods (where it makes sense) to match the HTML5 API - see the docs for more info
    • The data attributes for the embeds are now data-plyr-provider and data-plyr-embed-id to prevent compatibility issues. These can be changed under config.attributes.embed if required
    • blankUrl -> blankVideo
    • volume is now 0 to 1 as per HTML5 spec
    • keyboardShorcuts (typo) is now just keyboard
    • loop is now loop.active in preparation for loop enhancements later
    • html option for custom controls removed in favour of the controls option which now accepts an array (to use built in controls) or a string of HTML for custom controls.
    • classes -> classNames
    • classes.videoWrapper -> classNames.video
    • classes.embedWrapper -> classNames.embed
    • classes.ready removed
    • classes.setup removed
    • classes.muted removed
    • classes.fullscreen.active removed in favour of the :fullscreen selector
    • selectors.html5 removed
    • selectors.embed removed
    • selectors.buttons.seek -> selectors.inputs.seek
    • selectors.volume.input -> selectors.inputs.volume
    • selectors.volume.display -> selectors.display.volume
    • selectors.currentTime -> selectors.display.currentTime
    • selectors.duration -> selectors.display.duration

    Polyfilling

    Because we're using the fancy new ES6 syntax, you will need to polyfill for vintage browsers if you want to use Plyr and still support them. Luckily there's a decent service for this that makes it painless, polyfill.io. Alternatively, you can use the prebuilt polyfilled build but bear in mind this is 20kb larger. I'd suggest working our your own polyfill strategy.

    Source code(tar.gz)
    Source code(zip)
Owner
Sam Potts
UI Designer & Developer
Sam Potts
HTML5

One file. Any browser. Same UI. Author: John Dyer http://j.hn/ Website: http://mediaelementjs.com/ License: MIT Meaning: Use everywhere, keep copyrigh

MediaElement.js 8k Dec 27, 2022
HTML5

One file. Any browser. Same UI. Author: John Dyer http://j.hn/ Website: http://mediaelementjs.com/ License: MIT Meaning: Use everywhere, keep copyrigh

MediaElement.js 8k Jan 8, 2023
LazyLoad Embed Vimeo Player - simple and lightweight plugin - pure JavaScript

Vimeo LazyLoad LazyLoad Embed Vimeo Player - simple and lightweight plugin - pure JavaScript Status View Preview Table of contents Status Quick Start

The MUDA Organization 23 Nov 3, 2022
A custom element (web component) for the Vimeo player.

<vimeo-video> A custom element (web component) for Vimeo. The element API matches the HTML5 <video> tag, so it can be easily swapped with other media,

Wesley Luyten 4 Dec 28, 2022
A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion

ReactPlayer A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia, M

Pete Cook 7.2k Jan 4, 2023
▶️ Streams a list of tracks from Youtube, Soundcloud, Vimeo...

PlayemJS PlayemJS is a front-end JavaScript component that manages a audio/video track queue and plays those tracks sequentially. It can currently pla

Adrien Joly 90 Nov 27, 2022
Recap let's you recap on your favourite social network videos by downloading them on your devices, from the range of YouTube, SoundCloud, Facebook, Twitter, Instagram, TikTok, Vimeo, Dailymotion, VK, or AOL.

Recap A Social Network Video Downloader Recap let's you recap on your favourite social network videos by downloading them on your devices, from the ra

John Oladele 4 Sep 24, 2022
LazyLoad Embed YouTube Player - simple and lightweight plugin - pure JavaScript

Youtube LazyLoad LazyLoad Embed Youtube Player - simple and lightweight plugin - pure JavaScript Status View Preview Table of contents Status Quick St

The MUDA Organization 25 Nov 29, 2022
Music-Player - Music player application built with HTML, CSS and vanilla JavaScript

Music-Player Music player application built with HTML, CSS and vanilla JavaScrip

Karthik Umashankar 1 Feb 10, 2022
SRS Player is a video streaming player, supports HLS/HTTP-FLV/WebRTC etc.

WordPress-Plugin-SrsPlayer SRS Player is a video streaming player, supports HLS/HTTP-FLV/WebRTC etc. Usage First, you should get your own video stream

ossrs 3 Jul 27, 2022
SRS Player is a video streaming player, supports HLS/HTTP-FLV/WebRTC etc.

SRS Player is a video streaming player, supports HLS/HTTP-FLV/WebRTC etc.

ossrs 12 Oct 15, 2022
An online stem player. Inspired by but not affiliated with YEEZY TECH X KANO Stem Player.

Stem Player Online An online stem player. Inspired by but not affiliated with YEEZY TECH X KANO Stem Player. https://stemplayeronline.com See the proj

Luke Weiler 23 Nov 13, 2022
Movie focused HTML5 Player

Movie focused HTML5 Player

Bruno Vieira 1.6k Dec 29, 2022
The HTML5 video player for the web

Flowplayer website | demos | docs For the impatient Download Flowplayer Unzip Drop the folder under your server Minimal setup <!DOCTYPE html> <head>

Flowplayer 1.9k Dec 30, 2022
Video.js - open source HTML5 & Flash video player

Video.js - HTML5 Video Player Video.js is a web video player built from the ground up for an HTML5 world. It supports HTML5 video and Media Source Ext

Video.js 34.8k Jan 5, 2023
AmplitudeJS: Open Source HTML5 Web Audio Library. Design your web audio player, the way you want. No dependencies required.

Documentation • Examples • Tutorials • Support Us • Get Professional Help AmplitudeJS is a lightweight JavaScript library that allows you to control t

Server Side Up 3.9k Jan 2, 2023
A web video player built for the HTML5 world using React library.

video-react Video.React is a web video player built from the ground up for an HTML5 world using React library. Installation Install video-react and pe

null 2.4k Jan 6, 2023
Accessible HTML5 Video Player

Accessible HTML5 Video Player What is it? A lightweight HTML5 video player which includes support for captions and screen reader accessibility. For de

PayPal 2.4k Jan 5, 2023
HTML5 fmp4 live stream (ll-fmp4) player written in TypeScript

umataste HTML5 fmp4 live stream (ll-fmp4) player written in TypeScript Feature Playback for fmp4 stream Extremely low latency of less than 0.1 second

もにょ~ん 5 Oct 21, 2022