How to use the plyr/dist/plyr.polyfilled.js function in plyr

To help you get started, we’ve selected a few plyr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TheScienceMuseum / collectionsonline / client / lib / listeners / audioplayer.js View on Github external
module.exports = () => {
  var audioplayer = document.querySelector(".c-audioplayer");
  if (audioplayer !== null) {
    var player = new Plyr(".c-audioplayer audio");
    var button = document.querySelector(".c-audioplayer__button");
    player.on("playing", event => {
      audioplayer.classList.add("c-audioplayer--playing");
      button.setAttribute("aria-label", "Pause audio");
    });
    player.on("pause", event => {
      audioplayer.classList.remove("c-audioplayer--playing");
      button.setAttribute("aria-label", "Play audio");
    });
    player.on("ended", event => {
      audioplayer.classList.remove("c-audioplayer--playing");
      button.setAttribute("aria-label", "Play audio");
    });

    button.addEventListener("click", event => {
      player.togglePlay();

plyr

A simple, accessible and customizable HTML5, YouTube and Vimeo media player

MIT
Latest version published 2 years ago

Package Health Score

67 / 100
Full package analysis