emp-chromecast-receiver-2-dev
Advanced tools
Comparing version 2.2.128-726 to 2.2.128-727
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.empReceiver=a()}}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};a[g][0].call(k.exports,function(b){var c=a[g][1][b];return e(c?c:b)},k,k.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";var d=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(){function a(){d(this,a)}return e(a,[{key:"init",value:function(a,b,c){if(this.mixins=a,this.context=b,this.opt={warn:!0,mergeDuplicates:!0},this.contextMethods=Object.getOwnPropertyNames(this.context.constructor.prototype),this.reactMethods=["componentWillMount","componentDidMount","componentWillReceiveProps","shouldComponentUpdate","componentWillUpdate","componentDidUpdate","componentWillUnmount"],c&&(this.opt.warn=void 0!==c.warn?c.warn:this.opt.warn,this.opt.mergeDuplicates=void 0!==c.mergeDuplicates?c.mergeDuplicates:this.opt.mergeDuplicates),this.mixins.constructor===Array)a.map(function(a){this.grabMethods(a)},this);else{if("function"!=typeof a&&"object"!=typeof a)throw"mixins expects a function, an array, or an object. Please and thank you";this.grabMethods(a)}}},{key:"addNewMethod",value:function(a,b){this.mixins.prototype?this.context.constructor.prototype[a]=this.mixins.prototype[a]:this.context.constructor.prototype[a]="object"==typeof b?b[a]:b.prototype[a],this.contextMethods=Object.getOwnPropertyNames(this.context.constructor.prototype)}},{key:"extendMethod",value:function(a,b,c){var d=this.context[b],e="object"==typeof c?c[a]:c.prototype[a];this.context[a]=function(){e.call(this,arguments),d.call(this,arguments)}}},{key:"grabMethods",value:function(a){var b=this,c=a,d="object"==typeof a?Object.getOwnPropertyNames(a):Object.getOwnPropertyNames(a.prototype);d.map(function(a){"constructor"!==a&&"render"!==a&&b.checkForMatch(a,c)},this)}},{key:"checkForMatch",value:function(a,b){var c=this;this.contextMethods.map(function(d){a===d&&(c.reactMethods.indexOf(a)>-1?c.extendMethod(a,d,b):(c.opt.warn,c.opt.mergeDuplicates&&c.extendMethod(a,d,b)))}),this.addNewMethod(a,b)}}]),a}(),g=new f;b.exports=g.init.bind(g)},{}],2:[function(a,b,c){(function(a){var c;c="undefined"!=typeof window?window:"undefined"!=typeof a?a:"undefined"!=typeof self?self:{},b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(a,b,c){function d(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function e(a){return"function"==typeof a}function f(a){return"number"==typeof a}function g(a){return"object"==typeof a&&null!==a}function h(a){return void 0===a}b.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0,d.defaultMaxListeners=10,d.prototype.setMaxListeners=function(a){if(!f(a)||a<0||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},d.prototype.emit=function(a){var b,c,d,f,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||g(this._events.error)&&!this._events.error.length)){if(b=arguments[1],b instanceof Error)throw b;throw TypeError('Uncaught, unspecified "error" event.')}if(c=this._events[a],h(c))return!1;if(e(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(d=arguments.length,f=new Array(d-1),i=1;i<d;i++)f[i-1]=arguments[i];c.apply(this,f)}else if(g(c)){for(d=arguments.length,f=new Array(d-1),i=1;i<d;i++)f[i-1]=arguments[i];for(j=c.slice(),d=j.length,i=0;i<d;i++)j[i].apply(this,f)}return!0},d.prototype.addListener=function(a,b){var c;if(!e(b))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,e(b.listener)?b.listener:b),this._events[a]?g(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,g(this._events[a])&&!this._events[a].warned){var c;c=h(this._maxListeners)?d.defaultMaxListeners:this._maxListeners,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,"function"==typeof console.trace)}return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function c(){this.removeListener(a,c),d||(d=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var d=!1;return c.listener=b,this.on(a,c),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-- >0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(d<0)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?e(a._events[b])?1:a._events[b].length:0}},{}],4:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.__esModule=!0;var g=a("global/window"),h=d(g),i=a("./receiver-play-button.js"),j=(d(i),h["default"].empPlayer),k=j.getComponent("ControlBar"),l=(j.getComponent("ReceiverPlayButton"),j.getComponent("Component")),m=function(a){function b(){e(this,b),a.apply(this,arguments)}return f(b,a),b}(k);m.prototype.options_={loadEvent:"play",children:{receiverPlayButton:{},empTimeDisplay:{mode:"currentTime"},progressControl:{},empTimeDisplay2:{mode:"remainingTime"}}},l.registerComponent("ControlBar",m),c["default"]=m,b.exports=c["default"]},{"./receiver-play-button.js":5,"global/window":2}],5:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.__esModule=!0;var g=a("global/window"),h=d(g),i=h["default"].empPlayer,j=i.getComponent("Component"),k=function(a){function b(c,d){e(this,b),a.call(this,c,d)}return f(b,a),b.prototype.buildCSSClass=function(){return"receiver-play-control"},b.prototype.createEl=function(){var b={className:this.buildCSSClass()},c=a.prototype.createEl.call(this,void 0,b,void 0);return c},b}(j);j.registerComponent("ReceiverPlayButton",k),c["default"]=k,b.exports=c["default"]},{"global/window":2}],6:[function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}c.__esModule=!0;var f=a("global/window"),g=d(f),h=g["default"].empPlayer,i=function(){function a(b){e(this,a),this.receiver_=b,this.player_=b.player_,this.player_.on(h.Events.ENDED,this.onEnded.bind(this)),this.player_.on(h.Events.ERROR,this.onError.bind(this)),this.player_.on(h.Events.LOADED_METADATA,this.onLoaded.bind(this))}return a.prototype.editTracksInfo=function(a){h.log("empMediaPlayer.editTracksInfo",a)},a.prototype.getCurrentTimeSec=function(){return Math.round(this.player_.currentTime())},a.prototype.getDurationSec=function(){return Math.round(this.player_.duration())},a.prototype.getState=function(){var a=cast.receiver.media.PlayerState.PLAYING;return this.player_.hasStarted()||this.player_.sourceChanging()?this.player_.paused()&&!this.player_.sourceChanging()&&(a=cast.receiver.media.PlayerState.PAUSED):a=cast.receiver.media.PlayerState.IDLE,a},a.prototype.getVolume=function(){h.log("empMediaPlayer.getVolume");var a=new cast.receiver.media.Volume;return a.level=this.player_.volume(),a.muted=this.player_.muted(),a},a.prototype.setVolume=function(a){h.log("empMediaPlayer.setVolume",a),this.player_.volume(a.level),this.player_.muted(a.muted)},a.prototype.load=function(a,b,c,d,e){h.log("empMediaPlayer.load",a,b,c,d,e)},a.prototype.pause=function(){h.log("empMediaPlayer.pause"),this.player_.pause()},a.prototype.play=function(){h.log("empMediaPlayer.play"),this.player_.play()},a.prototype.registerEndedCallback=function(a){this.endedCallback_=a},a.prototype.unregisterEndedCallback=function(){this.endedCallback_=null},a.prototype.onEnded=function(a,b){h.log("onEnded",a),this.endedCallback_&&(h.log("empMediaPlayer.endedCallback"),this.endedCallback_())},a.prototype.registerErrorCallback=function(a){this.errorCallback_=a},a.prototype.unregisterErrorCallback=function(){this.errorCallback_=null},a.prototype.onError=function(a){var b=this.player_.getError();this.errorCallback_&&(h.log("empMediaPlayer.errorCallback",b),this.errorCallback_(b))},a.prototype.registerLoadCallback=function(a){this.loadCallback_=a},a.prototype.unregisterLoadCallback=function(){this.loadCallback_=null},a.prototype.onLoaded=function(a,b){this.loadCallback_&&(h.log("empMediaPlayer.loadCallback_"),this.loadCallback_(),this.receiver_.loadingState_=!1)},a.prototype.reset=function(){h.log("empMediaPlayer.reset"),this.player_.analytics&&this.player_.analytics().stop(),this.player_.reset()},a.prototype.seek=function(a,b){h.log("empMediaPlayer.seek",a,b),this.player_.canSeekTo(a)&&this.player_.currentTime(a),"PLAYBACK_START"===b&&this.player_.paused()?this.player_.play():"PLAYBACK_PAUSE"!==b||this.player_.paused()||this.player_.pause()},a}();c["default"]=i,b.exports=c["default"]},{"global/window":2}],7:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}c.__esModule=!0;var e=function g(){d(this,g),this.METADATA_UPDATED="metadataupdate",this.STATE_CHANGED="statechanged",this.RESOLUTION_CHANGED="resolutionchanged"},f=new e;c["default"]=f,b.exports=c["default"]},{}],8:[function(b,c,d){"use strict";function e(a){return a&&a.__esModule?a:{"default":a}}function f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}d.__esModule=!0;var g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),h=b("global/window"),i=e(h),j=b("events"),k=e(j),l=b("es6-mixins"),m=e(l),n=b("./emp-receiver-events.js"),o=e(n),p=b("./emp-mediaplayer.js"),q=e(p),r=b("./controls/receiver-control-bar.js"),s=(e(r),i["default"].empPlayer),t=(i["default"].empShaka,s.Events),u={LAUNCHING:"launching",LOADING:"loading",BUFFERING:"buffering",SEEKING:"seeking",PLAYING:"playing",PAUSED:"paused",DONE:"done",IDLE:"idle"},v={LAUNCHING:3e5,LOADING:3e5,PAUSED:12e5,IDLE:3e5,DONE:3e5},w=function(){function a(b,c){var d=this,e=arguments.length<=2||void 0===arguments[2]?function(){}:arguments[2];f(this,a),m["default"](k["default"],this),s.log("Created"),this.options_=Object.assign({debug:!1,messageUrn:"urn:x-cast:com.ericsson.cast.receiver",playerOptions:{}},c),this.debug_=c.debug,this.element_=b,this.mediaManager_=null,this.loadingState_=!1,this.shutdownWhenLastSenderDisconnect_=!0,this.isConnected_=!1,this.isChromecast_=i["default"].navigator.userAgent.indexOf("CrKey")>=0,this.onCastStatusChanged_(u.LAUNCHING),this.castReceiverManager_=cast.receiver.CastReceiverManager.getInstance(),this.castReceiverManager_.onSystemVolumeChanged=this.onSystemVolumeChanged_.bind(this),this.castReceiverManager_.onShutdown=this.onShutdown_.bind(this),this.castReceiverManager_.onSenderConnected=this.onSenderConnected_.bind(this),this.castReceiverManager_.onSenderDisconnected=this.onSenderDisconnected_.bind(this),this.castReceiverManager_.onSenderConnected=this.onSendersChanged_.bind(this),this.messageBus_=this.castReceiverManager_.getCastMessageBus(this.options_.messageUrn),this.messageBus_.addEventListener("message",this.onMessage.bind(this)),this.createPlayer(function(){d.mediaPlayer_=new q["default"](d),d.isChromecast_?(d.mediaManager_=new cast.receiver.MediaManager(d.mediaPlayer_),d.onLoadOrig_=d.mediaManager_.onLoad.bind(d.mediaManager_),d.mediaManager_.onLoad=d.onLoad_.bind(d),d.onQueueLoadOrig_=d.mediaManager_.onQueueLoad.bind(d.mediaManager_),d.mediaManager_.onQueueLoad=d.onQueueLoad_.bind(d),d.onMetadataLoadedOrig_=d.mediaManager_.onMetadataLoaded.bind(d.mediaManager_),d.mediaManager_.onMetadataLoaded=d.onMetadataLoaded_.bind(d),d.onLoadMetadataErrorOrig_=d.mediaManager_.onLoadMetadataError.bind(d.mediaManager_),d.mediaManager_.onLoadMetadataError=d.onLoadMetadataError_.bind(d),d.onErrorOrig_=d.mediaManager_.onError.bind(d.mediaManager_),d.mediaManager_.onError=d.onError_.bind(d),d.onPlayOrig_=d.mediaManager_.onPlay.bind(d.mediaManager_),d.mediaManager_.onPlay=d.onPlay_.bind(d),d.onPauseOrig_=d.mediaManager_.onPause.bind(d.mediaManager_),d.mediaManager_.onPause=d.onPause_.bind(d),d.onEndedOrig_=d.mediaManager_.onEnded.bind(d.mediaManager_),d.mediaManager_.onEnded=d.onEnded_.bind(d),d.onStopOrig_=d.mediaManager_.onStop.bind(d.mediaManager_),d.mediaManager_.onStop=d.onStop_.bind(d),d.onSetVolumeOrig_=d.mediaManager_.onSetVolume.bind(d.mediaManager_),d.mediaManager_.onSetVolume=d.onSetVolume_.bind(d),d.onSeekOrig_=d.mediaManager_.onSeek.bind(d.mediaManager_),d.mediaManager_.onSeek=d.onSeek_.bind(d),d.mediaManager_.customizedStatusCallback=function(a){return d.player_&&(a=d.updateMediaInfo_(a)),a.customData={playerState:a.playerState},s.log("mediaStatus",a),a}):(d.onQueueLoadOrig_=d.mockMediaManagerEvent_.bind(d),d.onLoadOrig_=d.mockMediaManagerEvent_.bind(d),d.onMetadataLoadedOrig_=d.mockMediaManagerEvent_.bind(d),d.onLoadMetadataErrorOrig_=d.mockMediaManagerEvent_.bind(d),d.onErrorOrig_=d.mockMediaManagerEvent_.bind(d),d.onPlayOrig_=d.mockMediaManagerEvent_.bind(d),d.onPauseOrig_=d.mockMediaManagerEvent_.bind(d),d.onEndedOrig_=d.mockMediaManagerEvent_.bind(d),d.onStopOrig_=d.mockMediaManagerEvent_.bind(d),d.onSetVolumeOrig_=d.mockMediaManagerEvent_.bind(d),d.onSeekOrig_=d.mockMediaManagerEvent_.bind(d)),d.debug_?(cast.receiver.logger.setLevelValue(cast.receiver.LoggerLevel.DEBUG),cast.player.api.setLoggerLevel(cast.player.api.LoggerLevel.DEBUG)):(cast.receiver.logger.setLevelValue(cast.receiver.LoggerLevel.ERROR),cast.player.api.setLoggerLevel(cast.player.api.LoggerLevel.NONE));var a=new cast.receiver.CastReceiverManager.Config;a.statusText=d.options_.statusText||"Casting EMP",d.isChromecast_?(d.castReceiverManager_.start(a),d.onCastStatusChanged_(u.IDLE)):(d.onCastStatusChanged_(u.IDLE),d.loadDebug_()),e()})}return a.prototype.updateMediaInfo_=function(a){if(a.media){this.setStreamType_(a.media);var b=this.player_.getProgramDetails(),c=this.player_.currentAsset();b?(a.contentId=b.assetId,a.media.empPayload={assetId:b.assetId,programId:b.programId,channelId:b.channelId},a.media.customData=a.media.empPayload):c?(a.contentId=c.programId?c.programId:c.assetId,a.media.empPayload={assetId:c.assetId,programId:c.programId,channelId:c.channelId},a.media.customData=a.media.empPayload):(a.contentId=this.player_.currentSrc(),a.media.empPayload={source:this.player_.currentSource()},a.media.customData=a.media.empPayload)}return a},a.prototype.setStreamType_=function(a){if(!this.player_.timeShiftEnabled()&&this.player_.isLive()||this.player_.duration()===1/0)a.duration=1/0,a.streamType="LIVE";else{var b=Math.round(this.player_.duration());isNaN(b)||(a.duration=b),a.streamType="BUFFERED"}},a.prototype.mockMediaManagerEvent_=function(a){s.log("mockMediaManagerEvent_",a),this.emit("mediamanagerevent",a)},a.prototype.onMessage=function(a){var b=JSON.parse(a.data);switch(s.log("onMessage",a.data,b),b.type){case"showtexttrack":this.player_.selectTextTrack(b.data.language,b.data.kind);break;case"hidetexttrack":this.player_.selectTextTrack(null);break;case"selectaudiotrack":this.player_.selectAudioTrack(b.data.language,b.data.kind);break;case"refreshcontrols":case"pull":this.pullResponse_(a);break;case"setabsolutetime":this.player_.setAbsoluteTime(new Date(b.data.datetime));break;case"playheadtime":this.player_.playheadTime(b.data);break;case"playnextprogram":this.player_.playNextProgram();break;case"playpreviousprogram":var c=b.data?b.data.end:void 0;this.player_.playPreviousProgram(c);break;case"gotolive":this.player_.gotoLive();break;case"texttrackstyle":this.player_.setTextTrackStyle(b.data);break;case"loadnextsource":this.player_.loadNextSource();break;case"lineupsource":this.player_.lineupSource(b.data)}},a.prototype.onEmpError=function(a){try{this.onCastStatusChanged_(u.IDLE),a||(a={}),s.log.error(a),this.player_.analytics&&(a&&!a.code&&(a.code=93),this.player_.analytics().onError(a),this.player_.analytics().onWindowUnload());var b=a.message;b&&(b=b.replace("Tech: EmpShaka","Tech: Chromecast"));var c={type:"ERROR",code:a.code,message:b};this.mediaManager_&&this.loadingState_&&this.mediaManager_.sendLoadError(cast.receiver.media.ErrorType.LOAD_FAILED,c),this.sendMessage({type:"error",data:c}),this.player_&&(this.player_.stop(),this.player_.reset())}catch(d){s.log.error(d)}},a.prototype.hideMediaResolution_=function(){this.emit(o["default"].RESOLUTION_CHANGED)},a.prototype.raiseResolutionChangedEvent_=function(){if(this.player_){var a=this.player_.videoWidth(),b=void 0;a>0&&a<1280?b="SD":a>=1280&&a<2048?b="HD":2048===a?b="2K":a>=3840&&a<=4096&&(b="4K"),this.emit(o["default"].RESOLUTION_CHANGED,b)}},a.prototype.loadDebug_=function(){if(!this.isChromecast_){s.log("Debugging the receiver UI in Chrome");var a=i["default"].localStorage.getItem("CC_loadRequest");if(a){var b=JSON.parse(a);s.log("loadRequest in localStorage",b),this.onLoad_({data:b})}else s.log("No loadRequest in localStorage")}},a.prototype.onQueueLoad_=function(a){s.log("onQueueLoad",a),this.onQueueLoadOrig_&&this.onQueueLoadOrig_(a)},a.prototype.onLoad_=function(a){var b=this;s.log("onLoad",a);var c=a.data;if(this.hasReceivedPlayingEvent_=!1,c.media.metadata&&this.emit(o["default"].METADATA_UPDATED,c.media.metadata),this.onCastStatusChanged_(u.LOADING),this.hideMediaResolution_(),this.loading)return s.log("onLoad blocking",a),void(this.loadNext=a);this.loading=setTimeout(function(){b.loading=null,b.loadNext&&b.onLoad_(b.loadNext)},1e4),this.loadNext=null,s.log("onLoad OK"),this.loadingState_=!0;var d=c.customData;if(!d)return void this.onEmpError({message:"No customData in the load request"});if(d.startTime=c.currentTime,c.queueData&&c.queueData.startTime&&c.queueData.startTime>0&&(d.startTime=c.queueData.startTime),c.queueData&&c.queueData.items&&c.queueData.items.length&&(c.queueData.items[c.queueData.startIndex].startTime=0),d.startTime=d.absoluteStartTime?0:d.startTime,d.analytics||(d.analytics={}),d.analytics.deviceInfo=this.getAnalyticsDeviceInfo_(),c&&c.autoplay===!1?(d.autoplay=!1,this.player_.autoplay(!1)):this.isChromecast_?(d.autoplay=!0,this.player_.autoplay(!0)):d.autoplay=c.autoplay,this.mediaManager_&&this.mediaManager_.getMediaQueue()&&this.mediaManager_.getMediaQueue().getLength()>1&&(d.hasMediaQueue=!0),this.player_.options(d),d.volume&&(this.player_.volume(d.volume.level),this.player_.muted(d.volume.muted)),d.language?this.player_.language(d.language):this.player_.language(""),this.player_.disableTimeShift(d.timeShiftDisabled),this.player_.one("canplay",function(){s.log("loadAsset","canplay",c.media),b.raiseResolutionChangedEvent_()}),this.player_.one("playing",function(){b.hasReceivedPlayingEvent_=!0,b.sendTracks_()}),this.player_.one("loadeddata",function(){c.autoplay===!1&&b.onCastStatusChanged_(u.PAUSED)}),d.sources&&d.sources.length>0)return s.log("player_.src",this.player_.options_),void this.player_.src(d.sources);if(d.source&&d.source.src)return void this.player_.src(d.source);var e={};d.playbackProperties?e=d.playbackProperties:d.absoluteStartTime?(e.startTime=d.absoluteStartTime,e.playFrom="startTime"):d.useLastViewedOffset?e.playFrom="bookmark":(e.playFrom="defaultBehaviour",e.startOffset=d.startTime?1e3*d.startTime:void 0),e.autoplay=d.autoplay,d.assetId||d.channelId||d.programId?this.player_.startPlayback(d.assetId,d.channelId,d.programId,e):c.media&&c.media.contentId&&"video/emp"===c.media.contentType?this.player_.startPlaybackV2(c.media.contentId,e):c.media&&(c.media.contentUrl&&(c.media.contentId=c.media.contentUrl),c.media.contentId&&this.player_.src({src:c.media.contentId,type:c.media.contentType,keySystems:d.keySystems,licenseServer:d.licenseServer,playToken:d.playToken}))},a.prototype.sendTracks_=function(){s.log("broadcasting embedded tracks");for(var a=0,b=[],c=[],d=this.player_.getSelectedTextTrack(),e=this.player_.textTracks(),f=0;f<e.length;f++,a++){var g=e[f];d&&g.language===d&&b.push(a);var h={label:g.label,language:g.language,type:"text",id:a,kind:g.kind};c.push(h)}for(var i=this.player_.audioTracks(),f=0;f<i.length;f++,a++){var j=i[f];j.enabled===!0&&b.push(a);var h={label:j.label,language:j.language,type:"audio",id:a,kind:j.kind};c.push(h)}var k={tracks:c,activeTrackIds:b},l={type:"tracksupdated",data:{tracksInfo:k}};this.sendMessage(l)},a.prototype.onMetadataLoaded_=function(a){s.log("onMetadataLoaded",a),a&&a.message&&a.message.media,this.onMetadataLoadedOrig_(a),this.loadingState_=!1},a.prototype.onLoadMetadataError_=function(a){this.onCastStatusChanged_(u.IDLE),s.log.error("onLoadMetadataError",a),this.player_.analytics&&(a&&!a.code&&(a.code=90),this.player_.analytics().onError(a),this.player_.analytics().onWindowUnload()),this.onLoadMetadataErrorOrig_(a)},a.prototype.onError_=function(a){try{this.onCastStatusChanged_(u.IDLE),s.log.error(a),this.player_.analytics&&(a&&!a.code&&(a.code=91),this.player_.analytics().onError(a),this.player_.analytics().onWindowUnload()),this.sendMessage({type:"error",data:a}),this.onErrorOrig_(a)}catch(b){s.log.error(b)}},a.prototype.onPlay_=function(a){s.log("play",a),this.onPlayOrig_(a)},a.prototype.onPause_=function(a){return s.log("pause",a),!this.player_.timeShiftEnabled()&&this.player_.isLive()?(s.log("sendStatus","onPause_"),void this.sendStatus(a.senderId,a.data.requestId)):void this.onPauseOrig_(a)},a.prototype.onSetVolume_=function(a){s.log("setVolume",a);var b=a.data.customData?a.data.customData.id:null;this.sendMessage({type:t.VOLUME_CHANGE,data:{volume:a.data.volume.level,muted:a.data.volume.muted,senderId:b}}),this.onSetVolumeOrig_(a)},a.prototype.pullResponse_=function(a){s.log("pull request",a),this.sendMessage({type:t.VOLUME_CHANGE,data:{volume:this.player_.volume(),muted:this.player_.muted()}}),this.sendMessage({type:"timeShiftEnabled",data:this.player_.timeShiftEnabled()}),this.sendMessage({type:"autoplay",data:this.player_.autoplay()}),this.sendMessage({type:"isLive",data:this.player_.isLive()}),this.sendMessage({type:"liveDelay",data:this.player_.liveDelay()});var b=this.player_.getProgramDetails(),c=this.player_.startTimeLive();b&&(c=b.start.getTime()),this.sendMessage({type:"startTimeLive",data:c}),b&&(b=Object.assign({},b),b.start=void 0,b.end=void 0,this.sendMessage({type:t.PROGRAM_CHANGED,data:{program:b}}));var d=this.player_.getAssetDetails();d&&this.sendMessage({type:t.ASSET_CHANGED,data:{asset:d}});var e=this.player_.entitlement;e&&this.sendMessage({type:t.ENTITLEMENT_CHANGE,data:{entitlement:e}}),this.sendTracks_(),this.sendStatus()},a.prototype.onShutdown_=function(a){s.log("shutdown",a)},a.prototype.onSendersChanged_=function(){this.isConnected_=0!==this.castReceiverManager_.getSenders().length},a.prototype.onSenderConnected_=function(a){s.log("SenderConnected",a.senderId,a.userAgent);var b=this.castReceiverManager_.getSenders(),c=b?b.length:0;s.log("senders",b,c)},a.prototype.onSenderDisconnected_=function(a){s.log("SenderDisconnected",a.senderId,a.userAgent,a.reason);var b=this.castReceiverManager_.getSenders(),c=b?b.length:0;s.log("senders",b,c),a.reason===cast.receiver.system.DisconnectReason.REQUESTED_BY_SENDER&&c<=1&&this.shutdownWhenLastSenderDisconnect_&&(s.log("shutdown no senders"),this.castReceiverManager_.stop(),this.player_.analytics&&this.player_.analytics().onWindowUnload())},a.prototype.onSystemVolumeChanged_=function(a){s.log("systemVolumeChanged",a),this.sendMessage({type:t.VOLUME_CHANGE,data:{volume:a.data.level,muted:a.data.muted}})},a.prototype.onSeek_=function(a){s.log("onSeek",a,this.state);var b=a.data.currentTime;this.player_.canSeekTo(b)?(this.seekEvent_=a,this.onSeekOrig_(a)):(s.log("sendStatus","onSeek_"),this.sendStatus(a.senderId,a.data.requestId))},a.prototype.hasQueItems=function(){if(this.mediaManager_&&this.mediaManager_.getMediaQueue()&&this.mediaManager_.getMediaQueue().getLength()>1){if(this.mediaManager_.getMediaQueue().getLength()-1===this.mediaManager_.getMediaQueue().getCurrentItemIndex()){var a=this.mediaManager_.getMediaQueue().getCurrentItem(),b=this.player_.currentSrc(),c=this.player_.currentAsset();return c&&(b=c.assetId),s.log("hasQueItems",b!==a.media.contentId),b!==a.media.contentId}if(this.mediaManager_.getMediaQueue().getLength()>1)return s.log("hasQueItems",!0),!0}return s.log("hasQueItems",!1),!1},a.prototype.onEnded_=function(a){var b=this;return this.hasQueItems()?(s.log.warn("receiver onEnded has QueItems",!0),this.player_.sourceChanging_=!0,void this.onEndedOrig_(a)):(this.player_.currentSources().length>1?setTimeout(function(){b.player_.ended()&&(b.onCastStatusChanged_(u.IDLE),b.onEndedOrig_(a))},3e3):(this.onCastStatusChanged_(u.IDLE),this.onEndedOrig_(a)),void s.log.warn("receiver onEnded has QueItems",!1))},a.prototype.onStop_=function(a){s.log("onStop_",a),this.player_&&this.player_.stop(),this.onCastStatusChanged_(u.IDLE),this.onStopOrig_(a)},a.prototype.getMediaInformation=function(){return this.mediaManager_&&this.mediaManager_.getMediaInformation()?this.mediaManager_.getMediaInformation():{}},a.prototype.getMediaManager=function(a){return void 0===a&&s.log.warn("Using the MediaManager directly can be dangerous. I hope you know what you're doing."),this.mediaManager_},a.prototype.getCastReceiverManager=function(a){return void 0===a&&s.log.warn("Using the CastReceiverManager directly can be dangerous. I hope you know what you're doing."),this.castReceiverManager_},a.prototype.getVideoElement=function(a){return void 0===a&&s.log.warn("Using the Video Element directly can be dangerous. I hope you know what you're doing."),this.player_.tech({IWillNotUseThisInPlugins:!0}).el_},a.prototype.onCastStatusChanged_=function(a){s.log("onCastStatusChanged_: "+a),this.state_=a,this.setIdleTimeout_(v[a.toUpperCase()]),this.emit(o["default"].STATE_CHANGED,a)},a.prototype.setIdleTimeout_=function(a){var b=this;s.log("setIdleTimeout_: "+a),clearTimeout(this.idleTimeout_),a&&!function(){var c=b;b.idleTimeout_=setTimeout(function(){c.castReceiverManager_.stop()},a)}()},a.prototype.getAnalyticsDeviceInfo_=function(){return{deviceModel:"Chromecast",deviceManufacturer:"Google",deviceAppInfo:"emp-chromecast-receiver v"+this.version}},a.prototype.shutdownWhenLastSenderDisconnect=function(a){return void 0===a?this.shutdownWhenLastSenderDisconnect_:void(this.shutdownWhenLastSenderDisconnect_=a)},a.prototype.createPlayer=function(a){var b=this;s.log("Create player");var c=this.options_.playerOptions;c.techOrder=["EmpShaka","EmpHLS-MSE","Html5"],c.controls=!0,this.options_&&this.options_.controls?c.children=this.options_.controls:c.children={mediaLoader:{},loadingSpinner:{},controlBar:{},empMediaInfoBar:{},posterImage:{},textTrackDisplay:{},errorDisplay:{},textTrackSettings:{}},c.analytics={},c.analytics.deviceInfo=this.getAnalyticsDeviceInfo_(),c.persistTextTrackSettings=!1,this.player_=new s(this.element_,c,a),this.player_.on(t.ERROR,function(a,c){"error"===a.type&&b.onEmpError(b.player_.getError()||{message:c})}),this.player_.on(t.SEGMENT_MISSING,function(){s.log("SEGMENT_MISSING");var a=-1;b.seekEvent_&&(a=b.seekEvent_.data.currentTime,s.log("sendStatus","SEGMENT_MISSING"),b.sendStatus(b.seekEvent_.senderId,b.seekEvent_.data.requestId),b.seekEvent_=null),b.sendMessage({type:t.SEGMENT_MISSING,data:a})}),this.player_.on(t.SEEKED,function(){s.log("SEEKED"),b.seekEvent_&&(s.log("sendStatus","SEEKED"),b.sendStatus(b.seekEvent_.senderId,b.seekEvent_.data.requestId),b.seekEvent_=null)}),this.player_.on(t.DURATION_CHANGE,function(){if(b.state_!==u.IDLE&&b.isConnected_&&b.mediaManager_){var a=b.getMediaInformation();if(a){var c=Math.round(b.player_.duration());isNaN(c)||a.duration===c||(s.log("sendStatus","DURATION_CHANGE"),b.sendStatus())}}}),this.player_.on(t.BITRATE_CHANGED,function(){return b.raiseResolutionChangedEvent_()}),this.player_.on(t.TRACK_CHANGE,function(){b.sendTracks_()}),this.player_.one(t.CAN_PLAY,function(){var a=b.player_.timeShiftEnabled();b.sendMessage({type:"timeShiftEnabled",data:a})}),this.player_.on(t.PROGRAM_CHANGED,function(a,c){var d=c&&c.program?c.program.programId:null;if(d){b.sendMessage({type:"startTimeLive",data:c.program.start.getTime()});var e=Object.assign({},c.program);e.start=void 0,e.end=void 0;var f=b.player_.programService().extractAssetMetadata(e.asset);b.updateMediaInformation_(f,c)}}),this.player_.on(t.ASSET_CHANGED,function(a,c){if(c&&c.asset){var d=b.player_.programService().extractAssetMetadata(c.asset);b.updateMediaInformation_(d,c)}}),this.player_.on(t.ENTITLEMENT_CHANGE,function(a,c){var d=c&&c.entitlement;d&&b.sendMessage({type:t.ENTITLEMENT_CHANGE,data:{entitlement:d}})}),this.player_.on("playing",function(){b.player_.error(null),b.onCastStatusChanged_(u.PLAYING)}),this.player_.on("pause",function(){b.player_.isPlaying()&&b.hasReceivedPlayingEvent_&&b.onCastStatusChanged_(u.PAUSED)}),this.player_.on("waiting",function(){b.state_!==u.IDLE&&b.onCastStatusChanged_(u.BUFFERING)}),this.player_.on("seeking",function(){b.onCastStatusChanged_(u.SEEKING)}),this.player_.on("abort",function(){b.hasReceivedPlayingEvent_!==!0||b.state_===u.LOADING&&b.state_===u.IDLE||b.onCastStatusChanged_(u.IDLE)}),this.player_.on(t.LOADED_DATA,function(){if(b.isConnected_&&b.mediaManager_&&b.player_.options_.empcast){var a=b.extractSourceMetadata_(b.player_.options_.empcast),c=a.images.length>0?a.images[0].url:"";a.title&&(b.player_.options({mediaInfo:{title:a.title,subtitle:a.subtitle,artworkUrl:c,artworkEnable:!0, | ||
logoEnable:!0,subtitleEnable:!0,titleEnable:!0}}),b.updateMediaInformation_(a))}b.sendMessage({type:"liveDelay",data:b.player_.liveDelay()}),b.sendMessage({type:"isLive",data:b.player_.isLive()})})},a.prototype.extractSourceMetadata_=function(a){return s.log("extractSourceMetadata",a),{title:a.title?a.title:"",subtitle:a.subtitle?a.subtitle:"",images:a.image?[a.image]:[]}},a.prototype.updateMediaInformation_=function(a,b){if(s.log("updateMediaInformation",a,b),this.isConnected_&&this.mediaManager_){var c=this.getMediaInformation();this.setStreamType_(c),c.metadata=c.metadata||{title:"",subtitle:"",images:[]},c.metadata.title=a.title?a.title:"",c.metadata.subtitle=a.subtitle?a.subtitle:"",c.metadata.images=a.images?a.images:[],b&&b.program?(c.contentId=b.program.assetId,c.empPayload={assetId:b.program.assetId,programId:b.program.programId,channelId:b.program.channelId},c.customData=c.empPayload):b&&b.asset&&(c.contentId=b.asset.assetId,c.empPayload={assetId:b.asset.assetId},c.customData=c.empPayload),s.log("updateMediaInformation",c),this.emit(o["default"].METADATA_UPDATED,c.metadata),this.mediaManager_.setMediaInformation(c,!0)}b&&b.program?this.sendMessage({type:t.PROGRAM_CHANGED,data:b}):b&&b.asset&&this.sendMessage({type:t.ASSET_CHANGED,data:b})},a.prototype.sendMessage=function(a,b){return s.log("sendMessage",a,b),this.isConnected_&&this.messageBus_?void(b?this.messageBus_.getCastChannel(b).send(JSON.stringify(a)):this.messageBus_.broadcast(JSON.stringify(a))):void this.emit("sendmessage",a)},a.prototype.sendStatus=function(a,b){s.log("sendStatus",a,b),this.isConnected_&&this.messageBus_&&(a?this.mediaManager_.sendStatus(a,b,!0,null,!0):this.mediaManager_.broadcastStatus(!0,null,null,!0))},g(a,[{key:"state",get:function(){return this.state_}},{key:"isChromecast",get:function(){return this.isChromecast_}},{key:"version",get:function(){return"2.2.128-726"}},{key:"player",get:function(){return this.player_}}]),a}();w.Events=o["default"],w.ReceiverStates=u,w.empPlayer=s,"function"==typeof a&&a.amd?a("empReceiver",[],function(){return w}):"object"==typeof d&&"object"==typeof c&&(c.exports=w),d["default"]=w,c.exports=d["default"]},{"./controls/receiver-control-bar.js":4,"./emp-mediaplayer.js":6,"./emp-receiver-events.js":7,"es6-mixins":1,events:3,"global/window":2}]},{},[8])(8)}); | ||
logoEnable:!0,subtitleEnable:!0,titleEnable:!0}}),b.updateMediaInformation_(a))}b.sendMessage({type:"liveDelay",data:b.player_.liveDelay()}),b.sendMessage({type:"isLive",data:b.player_.isLive()})})},a.prototype.extractSourceMetadata_=function(a){return s.log("extractSourceMetadata",a),{title:a.title?a.title:"",subtitle:a.subtitle?a.subtitle:"",images:a.image?[a.image]:[]}},a.prototype.updateMediaInformation_=function(a,b){if(s.log("updateMediaInformation",a,b),this.isConnected_&&this.mediaManager_){var c=this.getMediaInformation();this.setStreamType_(c),c.metadata=c.metadata||{title:"",subtitle:"",images:[]},c.metadata.title=a.title?a.title:"",c.metadata.subtitle=a.subtitle?a.subtitle:"",c.metadata.images=a.images?a.images:[],b&&b.program?(c.contentId=b.program.assetId,c.empPayload={assetId:b.program.assetId,programId:b.program.programId,channelId:b.program.channelId},c.customData=c.empPayload):b&&b.asset&&(c.contentId=b.asset.assetId,c.empPayload={assetId:b.asset.assetId},c.customData=c.empPayload),s.log("updateMediaInformation",c),this.emit(o["default"].METADATA_UPDATED,c.metadata),this.mediaManager_.setMediaInformation(c,!0)}b&&b.program?this.sendMessage({type:t.PROGRAM_CHANGED,data:b}):b&&b.asset&&this.sendMessage({type:t.ASSET_CHANGED,data:b})},a.prototype.sendMessage=function(a,b){return s.log("sendMessage",a,b),this.isConnected_&&this.messageBus_?void(b?this.messageBus_.getCastChannel(b).send(JSON.stringify(a)):this.messageBus_.broadcast(JSON.stringify(a))):void this.emit("sendmessage",a)},a.prototype.sendStatus=function(a,b){s.log("sendStatus",a,b),this.isConnected_&&this.messageBus_&&(a?this.mediaManager_.sendStatus(a,b,!0,null,!0):this.mediaManager_.broadcastStatus(!0,null,null,!0))},g(a,[{key:"state",get:function(){return this.state_}},{key:"isChromecast",get:function(){return this.isChromecast_}},{key:"version",get:function(){return"2.2.128-727"}},{key:"player",get:function(){return this.player_}}]),a}();w.Events=o["default"],w.ReceiverStates=u,w.empPlayer=s,"function"==typeof a&&a.amd?a("empReceiver",[],function(){return w}):"object"==typeof d&&"object"==typeof c&&(c.exports=w),d["default"]=w,c.exports=d["default"]},{"./controls/receiver-control-bar.js":4,"./emp-mediaplayer.js":6,"./emp-receiver-events.js":7,"es6-mixins":1,events:3,"global/window":2}]},{},[8])(8)}); | ||
//# sourceMappingURL=emp-receiver.min.js.map |
{ | ||
"name": "emp-chromecast-receiver-2-dev", | ||
"version.old": "2.2.128-1", | ||
"version": "2.2.128-726", | ||
"version": "2.2.128-727", | ||
"description": "EMP Receiver v2", | ||
@@ -6,0 +6,0 @@ "main": "./dist/js/emp-receiver.min.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package