constructor ($ctx, options = {}) { this.$ctx = $ctx this.settings = $.extend({ }, { autoplay: this.$ctx[0].hasAttribute(`data-autoplay`), playerIdPrefix: 'mpxPlayer', selectors: { blockName: 'MPXVideoPlayer' } }, options) this.$ctx.data('player-instance', this) this.playerId = this.$ctx.attr('id') this.playerXml = `<?xml version='1.0'?> <layout> <controls> <region id='tpBottomFloatRegion'> <row paddingTop="20"> <spacer width="10%" /> <control id='tpPlay' /> <control id='tpMute' /> //<spacer width="5%" /> <group> <control id='tpCurrentTime'/> <control id='tpScrubber'/> <control id='tpTotalTime'/> </group> //<spacer width="5%" /> <control id='tpFullScreen' scaleIcon='true' /> <spacer width="10%" /> </row> </region> </controls> </layout>` this.$ctx.find('iframe' + '#mpxPlayer' + this.playerId).off('load').on('load', () => { this.playerController = window.videoPlayerControllers[this.playerId] let checkForPDKReady = setInterval(() => { if (isPDKloaded()) { clearInterval(checkForPDKReady) this.playerController.addEventListener('OnReleaseStart', (e) => { this.onMediaReady(e) }) this.playerController.addEventListener('OnMediaStart', (e) => { this.onMediaStart(e) }) this.playerController.addEventListener('OnMediaPlaying', (e) => { this.onMediaPlaying(e) }) this.playerController.addEventListener('OnReleaseEnd', (e) => { this.onMediaEnded(e) }) this.playerController.addEventListener('OnMute', (e) => { this.onPlayerMute(e) }) this.playerController.addEventListener('OnMediaPause', (e) => { this.onPlayerPause(e) }) this.playerController.addEventListener('OnMediaUnpause', (e) => { this.onPlayerUnpause(e) }) this.init() } }, 100) }) }
constructor ($ctx, options = {}) { this.$ctx = $ctx this.settings = $.extend({ }, { autoplay: true, playerIdPrefix: 'HTML5Player', selectors: { blockName: 'HTML5VideoPlayer' } }, options) this.$ctx.data('player-instance', this) this.playerId = this.$ctx.attr('id') }