carhop__plugins__PROD-DEV/plugins/carhop-blocks/build/audio-player/view.js
2026-05-21 15:12:29 +02:00

30 lines
1001 B
JavaScript

/******/ (() => { // webpackBootstrap
/*!**********************************!*\
!*** ./src/audio-player/view.js ***!
\**********************************/
/**
* Initializes Plyr audio player on the front-end
* Note: Plyr is loaded as a dependency via PHP (see audio-player.php)
*/
// Initialize Plyr on all audio elements with the js-plyr class
document.addEventListener("DOMContentLoaded", () => {
// Check if Plyr is available (loaded via PHP)
if (typeof Plyr === "undefined") {
/* eslint-disable no-console */
console.error("Plyr library not loaded");
/* eslint-enable no-console */
return;
}
const players = Array.from(document.querySelectorAll(".js-plyr")).map(element => new Plyr(element, {
controls: ["play-large", "play", "progress", "current-time", "duration", "mute", "volume", "settings"],
settings: ["speed"],
speed: {
selected: 1,
options: [0.5, 0.75, 1, 1.25, 1.5, 2]
}
}));
});
/******/ })()
;
//# sourceMappingURL=view.js.map