1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-23 07:22:20 +00:00
ghostream/web/static/ovenplayer/ovenplayer.provider.WebRTCProvider-0.9.0.js

2 lines
93 KiB
JavaScript
Raw Normal View History

2020-11-20 01:46:25 +00:00
/*! For license information please see ovenplayer.provider.WebRTCProvider-0.9.0.js.LICENSE */
(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{312:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=d(r(318)),i=d(r(319)),o=d(r(66)),a=d(r(313)),s=r(308),c=r(1);function d(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t,r){OvenPlayerConsole.log("[Provider] loaded. ");var d={};(0,o.default)(d);var u=e.element,p=null,l=null;e.adTagUrl&&(OvenPlayerConsole.log("[Provider] Ad Client - ",t.getAdClient()),(p=t.getAdClient()===c.AD_CLIENT_VAST?(0,i.default)(u,d,t,e.adTagUrl):(0,n.default)(u,d,t,e.adTagUrl))||console.log("Can not load due to google ima for Ads.")),l=(0,a.default)(u,d,p?p.videoEndedCallback:null,t),u.playbackRate=u.defaultPlaybackRate=t.getPlaybackRate();var f=function(n){var i=e.sources[e.currentSource];if(e.framerate=i.framerate,d.setVolume(t.getVolume()),e.framerate||t.setTimecodeMode(!0),r)r(i,n);else{OvenPlayerConsole.log("source loaded : ",i,"lastPlayPosition : "+n);var o=u.src;i.file!==o&&(u.src=i.file,(o||""===o)&&u.load(),n&&n>0&&d.seek(n)),n>0&&(d.seek(n),t.isAutoStart()),t.isAutoStart()}};return d.getName=function(){return e.name},d.canSeek=function(){return e.canSeek},d.setCanSeek=function(t){e.canSeek=t},d.isSeeking=function(){return e.seeking},d.setSeeking=function(t){e.seeking=t},d.setMetaLoaded=function(){e.isLoaded=!0},d.metaLoaded=function(){return e.isLoaded},d.setState=function(t){if(e.state!==t){var r=e.state;if(OvenPlayerConsole.log("Provider : setState()",t),r===c.STATE_AD_PLAYING&&(t===c.STATE_ERROR||t===c.STATE_IDLE))return!1;switch(OvenPlayerConsole.log("Provider : triggerSatatus",t),t){case c.STATE_COMPLETE:d.trigger(c.PLAYER_COMPLETE);break;case c.STATE_PAUSED:d.trigger(c.PLAYER_PAUSE,{prevState:e.state,newstate:c.STATE_PAUSED});break;case c.STATE_AD_PAUSED:d.trigger(c.PLAYER_PAUSE,{prevState:e.state,newstate:c.STATE_AD_PAUSED});break;case c.STATE_PLAYING:d.trigger(c.PLAYER_PLAY,{prevState:e.state,newstate:c.STATE_PLAYING});case c.STATE_AD_PLAYING:d.trigger(c.PLAYER_PLAY,{prevState:e.state,newstate:c.STATE_AD_PLAYING})}e.state=t,d.trigger(c.PLAYER_STATE,{prevstate:r,newstate:e.state})}},d.getState=function(){return e.state},d.setBuffer=function(t){e.buffer=t},d.getBuffer=function(){return e.buffer},d.isLive=function(){return!!e.isLive||u.duration===1/0},d.getDuration=function(){return d.isLive()?1/0:u.duration},d.getPosition=function(){return u?u.currentTime:0},d.setVolume=function(e){if(!u)return!1;u.volume=e/100},d.getVolume=function(){return u?100*u.volume:0},d.setMute=function(e){return!!u&&(void 0===e?(u.muted=!u.muted,d.trigger(c.CONTENT_MUTE,{mute:u.muted})):(u.muted=e,d.trigger(c.CONTENT_MUTE,{mute:u.muted})),u.muted)},d.getMute=function(){return!!u&&u.muted},d.preload=function(r,n){return e.sources=r,e.currentSource=(0,s.pickCurrentSource)(r,e.currentSource,t),f(n||0),new Promise(function(e,r){t.isMute()&&d.setMute(!0),t.getVolume()&&d.setVolume(t.getVolume()),e()})},d.load=function(r){e.sources=r,e.currentSource=(0,s.pickCurrentSource)(r,e.currentSource,t),f(e.sources.starttime||0)},d.play=function(){if(OvenPlayerConsole.log("Provider : play()"),!u)return!1;if(d.getState()!==c.STATE_PLAYING)if(p&&p.isActive()||p&&!p.started())p.play().then(function(e){OvenPlayerConsole.log("Provider : ads play success")}).catch(function(e){OvenPlayerConsole.log("Provider : ads play fail",e)});else{var e=u.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)")}},d.pause=function(){if(OvenPlayerConsole.log("Provider : pause()"),!u)return!1;d.getState()===c.STATE_PLAYING?u.pause():d.getState()===c.STATE_AD_PLAYING&&p.pause()},d.seek=function(e){if(!u)return!1;u.currentTime=e},d.setPlaybackRate=function(e){return!!u&&(d.trigger(c.PLAYBACK_RATE_CHANGED,{playbackRate:e}),u.playbackRate=u.defaultPlaybackRate=e)},d.getPlaybackRate=function(){return u?u.playbackRate:0},d.getSources=function(){return u?e.sources.map(function(e,t){var r={file:e.file,type:e.type,label