ghostream/web/static/ovenplayer/ovenplayer.provider.DashPro...

2 lines
14 KiB
JavaScript
Raw Normal View History

2020-11-09 12:48:44 +00:00
/*! For license information please see ovenplayer.provider.DashProvider-0.9.0.js.LICENSE */
(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{136:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e,t,r){var n=t?1e3:1024;if(Math.abs(e)<n)return e+" B";var o=r||"B",a=["k"+o,"M"+o,"G"+o,"T"+o,"P"+o,"E"+o,"Z"+o,"Y"+o],i=-1;do{e/=n,++i}while(Math.abs(e)>=n&&i<a.length-1);return e.toFixed(1)+a[i]}},310:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=l(r(316)),o=l(r(317)),a=l(r(66)),i=l(r(311)),u=r(306),s=r(1);function l(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t,r){OvenPlayerConsole.log("[Provider] loaded. ");var l={};(0,a.default)(l);var c=e.element,d=null,g=null;e.adTagUrl&&(OvenPlayerConsole.log("[Provider] Ad Client - ",t.getAdClient()),(d=t.getAdClient()===s.AD_CLIENT_VAST?(0,o.default)(c,l,t,e.adTagUrl):(0,n.default)(c,l,t,e.adTagUrl))||console.log("Can not load due to google ima for Ads.")),g=(0,i.default)(c,l,d?d.videoEndedCallback:null),c.playbackRate=c.defaultPlaybackRate=t.getPlaybackRate();var E=function(n){var o=e.sources[e.currentSource];if(e.framerate=o.framerate,l.setVolume(t.getVolume()),e.framerate||t.setTimecodeMode(!0),r)r(o,n);else{OvenPlayerConsole.log("source loaded : ",o,"lastPlayPosition : "+n);var a=c.src;o.file!==a&&(c.src=o.file,(a||""===a)&&c.load(),n&&n>0&&l.seek(n)),n>0&&(l.seek(n),t.isAutoStart()),t.isAutoStart()}};return l.getName=function(){return e.name},l.canSeek=function(){return e.canSeek},l.setCanSeek=function(t){e.canSeek=t},l.isSeeking=function(){return e.seeking},l.setSeeking=function(t){e.seeking=t},l.setMetaLoaded=function(){e.isLoaded=!0},l.metaLoaded=function(){return e.isLoaded},l.setState=function(t){if(e.state!==t){var r=e.state;if(OvenPlayerConsole.log("Provider : setState()",t),r===s.STATE_AD_PLAYING&&(t===s.STATE_ERROR||t===s.STATE_IDLE))return!1;switch(OvenPlayerConsole.log("Provider : triggerSatatus",t),t){case s.STATE_COMPLETE:l.trigger(s.PLAYER_COMPLETE);break;case s.STATE_PAUSED:l.trigger(s.PLAYER_PAUSE,{prevState:e.state,newstate:s.STATE_PAUSED});break;case s.STATE_AD_PAUSED:l.trigger(s.PLAYER_PAUSE,{prevState:e.state,newstate:s.STATE_AD_PAUSED});break;case s.STATE_PLAYING:l.trigger(s.PLAYER_PLAY,{prevState:e.state,newstate:s.STATE_PLAYING});case s.STATE_AD_PLAYING:l.trigger(s.PLAYER_PLAY,{prevState:e.state,newstate:s.STATE_AD_PLAYING})}e.state=t,l.trigger(s.PLAYER_STATE,{prevstate:r,newstate:e.state})}},l.getState=function(){return e.state},l.setBuffer=function(t){e.buffer=t},l.getBuffer=function(){return e.buffer},l.isLive=function(){return!!e.isLive||c.duration===1/0},l.getDuration=function(){return l.isLive()?1/0:c.duration},l.getPosition=function(){return c?c.currentTime:0},l.setVolume=function(e){if(!c)return!1;c.volume=e/100},l.getVolume=function(){return c?100*c.volume:0},l.setMute=function(e){return!!c&&(void 0===e?(c.muted=!c.muted,l.trigger(s.CONTENT_MUTE,{mute:c.muted})):(c.muted=e,l.trigger(s.CONTENT_MUTE,{mute:c.muted})),c.muted)},l.getMute=function(){return!!c&&c.muted},l.preload=function(r,n){return e.sources=r,e.currentSource=(0,u.pickCurrentSource)(r,e.currentSource,t),E(n||0),new Promise(function(e,r){t.isMute()&&l.setMute(!0),t.getVolume()&&l.setVolume(t.getVolume()),e()})},l.load=function(r){e.sources=r,e.currentSource=(0,u.pickCurrentSource)(r,e.currentSource,t),E(e.sources.starttime||0)},l.play=function(){if(OvenPlayerConsole.log("Provider : play()"),!c)return!1;if(l.getState()!==s.STATE_PLAYING)if(d&&d.isActive()||d&&!d.started())d.play().then(function(e){OvenPlayerConsole.log("Provider : ads play success")}).catch(function(e){OvenPlayerConsole.log("Provider : ads play fail",e)});else{var e=c.play();void 0!==e?e.then(function(){OvenPlayerConsole.log("Provider : video play success")}).catch(function(e){OvenPlayerConsole.log("Provider : video play error",e.message)}):OvenPlayerConsole.log("Provider : video play success (ie)")}},l.pause=function(){if(OvenPlayerConsole.log("Provider : pause()"),!c)return!1;l.getState()===s.STATE_PLAYING?c.pause():l.getState()===s.STATE_AD_PLAYING&&d.pause()},l.seek=function(e){if(!c)return!1;c.curr