1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-23 06:12:20 +00:00
ghostream/web/static/ovenplayer/ovenplayer.provider.DashProvider~ovenplayer.provider.HlsProvider~ovenplayer.provider.Html5~ovenplaye~2ec193ac-0.9.0.js

2 lines
55 KiB
JavaScript
Raw Normal View History

2020-11-09 12:48:44 +00:00
/*! For license information please see ovenplayer.provider.DashProvider~ovenplayer.provider.HlsProvider~ovenplayer.provider.Html5~ovenplaye~2ec193ac-0.9.0.js.LICENSE */
(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{306:function(e,t,A){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pickCurrentSource=t.errorTrigger=t.separateLive=t.extractVideoElement=void 0;var n=A(1),i=function(e){return e&&e.__esModule?e:{default:e}}(A(7));t.extractVideoElement=function(e){return i.default.isElement(e)?e:e.getVideoElement?e.getVideoElement():e.media?e.media:null},t.separateLive=function(e){return!(!e||!e.isDynamic)&&e.isDynamic()},t.errorTrigger=function(e,t){t&&(t.setState(n.STATE_ERROR),t.pause(),t.trigger(n.ERROR,e))},t.pickCurrentSource=function(e,t,A){var n=Math.max(0,t);if(e)for(var i=0;i<e.length;i++)if(e[i].default&&(n=i),A.getSourceIndex()===i)return i;return n}},316:function(e,t,A){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(A(384)),i=A(337),r=o(A(6)),a=(A(306),A(1));function o(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t,A,o,s){var l="",u="",c={},d=!1,h=!1,p={started:!1,active:!1,isVideoEnded:!1},g=null,v=null,m=null,f=null,T=null,y=null,E=null,k=!1,C=!1,R=A.getBrowser(),L="Android"===R.os||"iOS"===R.os;OvenPlayerConsole.log("IMA : started ","isMobile : ",L,o);try{l=google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,u=google.ima.AdErrorEvent.Type.AD_ERROR,google.ima.settings.setLocale(A.getLanguage()),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(!0),v=function(e){console.log(e.getError().getVastErrorCode(),e.getError().getMessage()),h=!0;var A=e.getError().getInnerError();A&&console.log(A.getErrorCode(),A.getMessage()),t.trigger(a.STATE_AD_ERROR,{code:e.getError().getVastErrorCode(),message:e.getError().getMessage()}),p.active=!1,p.started=!0,t.play()},g=function(A){OvenPlayerConsole.log("IMA : OnManagerLoaded ");var i=new google.ima.AdsRenderingSettings;i.restoreCustomPlaybackStateOnAdBreakComplete=!0,T&&(OvenPlayerConsole.log("IMA : destroy adsManager----"),y.destroy(),y=null,T.destroy(),T=null),T=A.getAdsManager(e,i),y=(0,n.default)(T,t,p,v),OvenPlayerConsole.log("IMA : created admanager and listner "),d=!0};var w=function(){var e=document.createElement("div");return e.setAttribute("class","op-ads"),e.setAttribute("id","op-ads"),A.getContainer().append(e),e}();m=new google.ima.AdDisplayContainer(w,e),(f=new google.ima.AdsLoader(m)).addEventListener(l,g,!1),f.addEventListener(u,v,!1),OvenPlayerConsole.log("IMA : adDisplayContainer initialized"),t.on(a.CONTENT_VOLUME,function(e){T&&(e.mute?T.setVolume(0):T.setVolume(e.volume/100))},c);var b=function(){E&&(OvenPlayerConsole.log("IMA : setADWillAutoPlay ","autoplayAllowed",k,"autoplayRequiresMuted",C),E.setAdWillAutoPlay(k),E.setAdWillPlayMuted(C),C&&t.trigger(a.PLAYER_WARNING,{message:a.WARN_MSG_MUTEDPLAY,timer:1e4,iconClass:a.UI_ICONS.volume_mute,onClickCallback:function(){t.setMute(!1)}}))};return c.isActive=function(){return p.active},c.started=function(){return p.started},c.play=function(){return p.started?new Promise(function(e,t){try{T.resume(),e()}catch(e){t(e)}}):(m.initialize(),new Promise(function(n,r){var s=0;(function(){OvenPlayerConsole.log("IMA : checkAutoplaySupport() ");var A=document.createElement("video");A.setAttribute("playsinline","true"),A.src=i.TEMP_VIDEO_URL,A.load(),L&&t.getName()!==a.PROVIDER_DASH&&e.load();var n=function(e,t){k=e,C=t,A.pause(),A.remove(),b()};return new Promise(function(e,t){if(A.play){var i=A.play();void 0!==i?i.then(function(){OvenPlayerConsole.log("IMA : auto play allowed."),n(!0,!1),e()}).catch(function(t){OvenPlayerConsole.log("IMA : auto play failed",t.message),n(!1,!1),e()}):(OvenPlayerConsole.log("IMA : promise not support"),n(!0,!1),e())}else OvenPlayerConsole.log("IMA : !temporarySupportCheckVideo.play"),n(!0,!1),e()})})().then(function(){A.isAutoStart()&&!k?(OvenPlayerConsole.log("IMA : autoplayAllowed : false"),p.started=!1,r(new Error("autoplayNotAllowed"))):(d=!1,OvenPlayerConsole.log("IMA : initRequest() AutoPlay Support : ","autoplayAllowed",k,"autoplayRequiresMuted",C),(E=new google.ima.AdsRequest).forceNonLinearFullSlot=!1,b(),E.adTagUrl=o,f.requestAds(E),OvenPlayerConsole.log("IMA : request