1 line
12 KiB
JavaScript
Raw Normal View History

2020-05-15 12:27:34 +02:00
webpackJsonpjwplayer([6],{159:function(a,b,c){var d,e;d=[c(116),c(77),c(73),c(161),c(163),c(160),c(162),c(48),c(62),c(45)],e=function(a,b,c,d,e,f,g,h,i,j){var k=h.noop,l={},m=function(m,n){function o(){return!j.isUndefined(m._instreamAdapter)}function p(a,b){g.log("send command",a,b);var c={command:a};void 0!==b&&(c.args=b),A.sendMessage(g.NS,c,k,function(a){g.log("error message",a),"Invalid namespace"===a.description&&G.stopCasting()})}function q(a){var b=g.available(a.availability);s(b)}function r(a,b){var c=JSON.parse(b);if(!c)throw"Message not proper JSON";if(c.reconcile){E.removeMessageListener(g.NS,this.listenForHandshakeHandler);var d=c.diff,e=E;d.id&&c.appid&&c.pageUrl||(d.id=window.jwplayer().id,c.appid=z.appid,c.pageUrl=C,E=A=null),d.id===n.get("id")&&c.appid===z.appid&&c.pageUrl===C&&(A||(o()&&m.instreamDestroy(),this.sessionStarted(e),this.castModel.set("state",i.IDLE)),this.handleMessage(c)),E=null}}function s(a){var b=!!a;B.available!==b&&(B.available=b,n.set("castAvailable",b))}function t(){return A&&A.receiver?A.receiver.friendlyName:""}function u(a){g.log("Cast Session Error:",a,A);var b=window.chrome;a.code!==b.cast.ErrorCode.CANCEL&&(g.log("Cast Session Error:",a,A),a.code===b.cast.ErrorCode.SESSION_ERROR&&this.stopCasting())}function v(a){var b=window.chrome;a.code!==b.cast.ErrorCode.CANCEL&&(g.log("Cast Session Error:",a,A),a.code===b.cast.ErrorCode.SESSION_ERROR&&this.stopCasting())}function w(a){a/=100,a=Math.max(0,Math.min(a,1)),A.setReceiverVolumeLevel(a,G.mirrorVolume.bind(G),function(a){g.error("set volume error",a)})}function x(a){A.setReceiverMuted(a,G.mirrorVolume.bind(G),function(a){g.error("set muted error",a)})}function y(a,b){function c(a){return function(){b.sendCommand(a)}}return{getContainer:function(){return document.createElement("div")},on:k,onAdPlay:k,onAdSkipped:k,onAdComplete:k,onAdError:k,onCaptionsList:k,onCaptionsChange:k,onPlaylistItem:k,onPlaylistComplete:k,onError:k,onResize:k,onReady:k,onFullscreen:k,getState:k,castToggle:k,setFullscreen:k,setVolume:w,setMute:function(){x(!a.get("mute"))},play:b.play.bind(b),pause:b.pause.bind(b),seek:b.seek.bind(b),playlistNext:c("next"),playlistPrev:c("prev"),load:b.load.bind(b)}}var z,A=null,B={available:!1,active:!1,deviceName:""},C=h.getAbsolutePath(window.location.href),D=null,E=null,F=null;z=j.extend({},l,n.get("cast"));var G=this;this.onExistingSession=function(a){g.log("existing session",a),A||E||(E=a.session,E.addMessageListener(g.NS,this.listenForHandshakeHandler))},this.setActive=function(a){B.active=!!a,B.deviceName=t(),this.castModel.set("castActive",!!a),this.castModel.set("deviceName",t()),this.castModel.set("castState",B)},this.startCasting=function(){if(!A&&!o()){var a=window.chrome;a.cast.requestSession(this.sessionStarted.bind(this),u)}},this.openExtension=function(){if(!o()){var a=window.chrome;a.cast.requestSession(this.sessionStarted.bind(this),v)}},this.stopCasting=function(){return A?(this.removeSessionListeners(),void A.stop(this.sessionStopped.bind(this),this.sessionStopError.bind(this))):void this.sessionStopped()},this.resumePlayback=function(){m.showView(m._view.element()),m.getProvider().name.indexOf("flash")>=0&&n.resetProvider(),m.load(this.castModel.get("item")),m.play()},this.sessionStopError=function(a){g.error("Cast Session Stop error:",a,A),this.sessionStopped()},this.sessionStarted=function(a){if(g.log("Session started:",a),A)this.stopCasting(),F=a;else if(A=a,A.addMessageListener(g.NS,this.onMessageHandler),A.addUpdateListener(this.sessionStatusHandler),this.setupControllerForCasting(),a!==E){var b=f.setupCastConfig(this.castModel,z);D.setup(b),d.sendDummyMedia(a)}},this.sessionStatus=function(a){g.log("Cast Session status",a),a?this.mirrorVolume():(this.castModel.set("state",i.BUFFERING),this.sessionStopped())},this.sessionStopped=function(){g.log("_sessionStopped"),A&&(this.removeSessionListeners(),A=null),D&&(D.destroy(),D=null),this.setActive(!1),null!==F&&(this.sessionStarted(F),F=null),this.resumePlayback()},this.removeSessionListeners=function(){A.removeUpdateListener(this.sessionStatusHandl