From: Stephen Cameron Date: Thu, 13 Jan 2022 17:54:50 +0000 (+0100) Subject: Refactor media player for reuse on other pages. WIP #5022 @3 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=941fe78baa0317b91a6d9cc807005c99aa7e3b88;p=odl.git Refactor media player for reuse on other pages. WIP #5022 @3 --- diff --git a/resources/js/media-library.js b/resources/js/media-library.js index 3317a15..c6a11f8 100644 --- a/resources/js/media-library.js +++ b/resources/js/media-library.js @@ -12,37 +12,6 @@ export default (options = {}) => ({ percentPosition: true, }, - player: {}, // Holds the Plyr instance - playerInitialised: false, - playerOptions: { // Settings used for Plyr instantiation (https://github.com/sampotts/plyr#options) - debug: false, - loadSprite: false, // Custom SVG sprite is already embedded in the page - }, - playerType: '', // Set when opening the player: video or audio - playerDuration: '00’00', - playerTime: '00’00', - playerTitle: '', - playerImage: '', - - /****************\ - | Initialisation | - \****************/ - - init() { - // Open player if querystring is already set - let querystring = new URLSearchParams(location.search); - let ID = querystring.get('id'); - if (ID) { - let media = document.querySelector(`#media_${ID}`) - if (media) { - this.maskContents = true; // Hide page contents while player loads - this.initPlayer('#player'); - this.openPlayer(JSON.parse(media.dataset.player), false); - this.maskContents = false; - } - } - }, - /***********\ | Filtering | \***********/ @@ -106,67 +75,4 @@ export default (options = {}) => ({ // Remove the filter from the array this.activeThemeFilters = this.activeThemeFilters.filter(item => item !== filterID); }, - - /**************\ - | Media Player | - \**************/ - - initPlayer(selector) { - - if (this.playerInitialised) { - return true; // Don't initialise player more than once - } - - // Get custom controls HTML from the