emp-chromecast-receiver-2
Advanced tools
Comparing version 2.0.85 to 2.0.86-152
@@ -28,10 +28,10 @@ # Release notes | ||
### New features | ||
**EMP-11084** Show progress and titel bar CC on programchange and assetchange. | ||
Show the program image with type === 'chromecast' in Chromecast demo receiver. | ||
- **EMP-11084** Show progress and titel bar CC on programchange and assetchange. | ||
- Show the program image with type === 'chromecast' in Chromecast demo receiver. | ||
### Bug fixes | ||
**EMP-11115** No ProgramChanged event in Analytic after program boundary crossing. | ||
**EMP-11005** HTML Player 2.0 - OffsetTime is missing for the following analytics event: Playback.ProgramChanged. | ||
**EMP-11060** Analytics is validate session every second when casting | ||
**EMP-10946** Analytic error: There is no timeout scheduled with the given id "3819903156412202" | ||
- **EMP-11115** No ProgramChanged event in Analytic after program boundary crossing. | ||
- **EMP-11005** HTML Player 2.0 - OffsetTime is missing for the following analytics event: Playback.ProgramChanged. | ||
- **EMP-11060** Analytics is validate session every second when casting | ||
- **EMP-10946** Analytic error: There is no timeout scheduled with the given id "3819903156412202" | ||
@@ -41,13 +41,13 @@ ## 2.0.80 Beta Release | ||
### New features | ||
**EMP-11161** Add Channel information to the program object | ||
**EMP-11085** Don't show title bar and buffering when it's not a real buffering, (stalling-playback) | ||
**EMP-11197** Program end as duration for live program | ||
- **EMP-11161** Add Channel information to the program object | ||
- **EMP-11085** Don't show title bar and buffering when it's not a real buffering, (stalling-playback) | ||
- **EMP-11197** Program end as duration for live program | ||
### Bug fixes | ||
**EMP-11167** CC Receiver - Sometimes the playback just stops on the receiver | ||
**EMP-10957** HTML Player 2.0 - Wrong error message: not entitled instead of stream not available | ||
**EMP-10979** Shaka - loading the stream for live channels take long time for some channels | ||
**EMP-11162** Cast error, can't recover code: session_error message: INVALID_MEDIA_SESSION_ID | ||
**EMP-11164** Flipping timebar - CurrentProgram remove before pre program switch to new program | ||
**EMP-11114** CC Receiver - Seeking crashes the receiver | ||
- **EMP-11167** CC Receiver - Sometimes the playback just stops on the receiver | ||
- **EMP-10957** HTML Player 2.0 - Wrong error message: not entitled instead of stream not available | ||
- **EMP-10979** Shaka - loading the stream for live channels take long time for some channels | ||
- **EMP-11162** Cast error, can't recover code: session_error message: INVALID_MEDIA_SESSION_ID | ||
- **EMP-11164** Flipping timebar - CurrentProgram remove before pre program switch to new program | ||
- **EMP-11114** CC Receiver - Seeking crashes the receiver | ||
@@ -57,17 +57,42 @@ ## 2.0.82 | ||
### New features | ||
**EMP-10978** Upgrade Shaka 2.2.6 -> 2.3.7 | ||
- **EMP-10978** Upgrade Shaka 2.2.6 -> 2.3.6 | ||
https://github.com/google/shaka-player/releases | ||
### Bug fixes | ||
Reset Shaka when new asset is cast. | ||
- **EMP-11340** Reset Shaka when new asset is cast. | ||
## 2.0.83 | ||
### Bug fixes | ||
- **EMP-11300** Chromecast version 1 not working | ||
- **EMP-11341** Can't casting to Chromecast v1, Unbundle libraries fix this issue. | ||
- **EMP-11342** emp-receiver don't include videojs, emp-player and emp-shaka theses have to be added to the index.html | ||
## 2.0.84 | ||
### Bug fixes | ||
- **EMP-11343** Event memory leak when cast new asset or program. | ||
### New features | ||
- **EMP-11344** Shaka 2.3.6-3: Only add new segment references for SegmentTimeline. | ||
- **EMP-11345** Shaka 2.3.6-4: Calculate liveEdge from last segment starttime for SegmentTimeline. | ||
- **EMP-11330** Send livedelay from CC receiver | ||
- **EMP-11346** Optimize start casting, reduce media status update. | ||
- **EMP-11347** Receiver do not close when last sender dissconect. | ||
- **EMP-11353** Don't try recover from error by try other tech on receiver. | ||
## 2.0.85 | ||
### Bug fixes | ||
EMP-11300 Chromecast version 1 not working | ||
Can't casting to Chromecast v1, Unbundle libraries fix this issue. | ||
emp-receiver don't include videojs, emp-player and emp-shaka theses have to be added to the index.html | ||
- **EMP-11346** Optimize start casting, reduce more media status update and send them not to early. | ||
- **EMP-11389** **contentID** Should be set to assetId, see documentation for Chromecast senders. *(This fix build-in minicontrol show up as it should)*. | ||
### New features | ||
- **EMP-11388** Set initiate volume level and muted when start casting. | ||
## 2.0.86 | ||
### New features | ||
- Upgrade HTML5 Player to 2.0.86 | ||
@@ -1,2 +0,2 @@ | ||
!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.LOAD_START,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){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_())},a.prototype.reset=function(){h.log("empMediaPlayer.reset"),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.assetMetadata_={title:"",subtitle:"",images:[]},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.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)),s.log("mediaStatus",a),a}):(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){!this.player_.timeShiftEnabled()&&this.player_.isLive()?(a.duration=1/0,a.streamType="LIVE"):(a.duration=Math.round(this.player_.duration()),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_();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_.autoplay(),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&&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.error("No loadRequest in localStorage")}},a.prototype.onLoad_=function(a){var b=this;s.log("onLoad",a);var c=a.data;if(this.hasReceivedPlayingEvent_=!1,this.assetMetadata_=c.media.metadata||{title:"",subtitle:"",images:[]},this.emit(o["default"].METADATA_UPDATED,this.assetMetadata_),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(c.currentTime>0&&(d.startTime=c.currentTime),d.startTime=d.absoluteStartTime?0:d.startTime,d.analytics||(d.analytics={}),d.analytics.deviceInfo=this.getAnalyticsDeviceInfo_(),c&&void 0!==c.autoplay&&this.player_.autoplay(c.autoplay),this.player_.options(d),this.player_.disableTimeShift(d.timeShiftDisabled),this.player_.one("canplay",function(){s.log("loadAsset","canplay",c.media),b.raiseResolutionChangedEvent_(),b.isConnected_&&(b.setStreamType_(c.media),b.mediaManager_.setMediaInformation(c.media))}),this.player_.one("playing",function(){b.hasReceivedPlayingEvent_=!0,b.sendStatus(),b.sendTracks_()}),this.player_.one("loadeddata",function(){c.autoplay===!1&&b.onCastStatusChanged_(u.PAUSED)}),this.player_.on(t.LOADED_DATA,function(){if(b.isConnected_&&b.mediaManager_){var a=b.getMediaInformation();a=b.updateMediaInfo_(a);var c=b.player_.currentSource();if(c.options&&c.options.empcast){var d=b.extractSourceMetadata_(c.options.empcast);b.updateMediaInformation_(d)}b.mediaManager_.setMediaInformation(a,!0)}}),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),this.player_.startPlayback(d.assetId,d.channelId,d.programId,e)},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&&(a.message.media.metadata=this.assetMetadata_,this.setStreamType_(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&&this.player_.analytics().onWindowUnload(),this.onLoadMetadataErrorOrig_(a)},a.prototype.onError_=function(a){try{this.onCastStatusChanged_(u.IDLE),s.log.error(a),this.player_.analytics&&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()?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(){s.log("pull request"),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()});var a=this.player_.getProgramDetails(),b=this.player_.startTimeLive();a&&(b=a.start.getTime()),this.sendMessage({type:"startTimeLive",data:b}),a&&(a=Object.assign({},a),a.start=void 0,a.end=void 0,this.sendMessage({type:t.PROGRAM_CHANGED,data:{program:a}}));var c=this.player_.getAssetDetails();c&&this.sendMessage({type:t.ASSET_CHANGED,data:{asset:c}});var d=this.player_.entitlement;d&&this.sendMessage({type:t.ENTITLEMENT_CHANGE,data:{entitlement:d}}),this.sendTracks_()},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&&0===c&&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)):this.sendStatus(a.senderId,a.data.requestId)},a.prototype.onEnded_=function(a){var b=this;s.log("onStop_",a),setTimeout(function(){b.player_.ended()&&(b.onCastStatusChanged_(u.IDLE),b.onEndedOrig_(a))},3e3)},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.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.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.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","Html5"],c.controls=!0,this.options_&&this.options_.controls?c.children=this.options_.controls:c.children={loadingSpinner:{},controlBar:{},mediaLoader:{},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,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_&&(b.sendStatus(b.seekEvent_.senderId,b.seekEvent_.data.requestId),b.seekEvent_=null)}),this.player_.on(t.DURATION_CHANGE,function(){if(b.state_!==u.IDLE){var a=b.player_.getProgramDetails();b.player_.isProgramLive()&&!a&&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)})},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){var c=this;if(s.log("updateMediaInformation",a,b),this.isConnected_&&this.mediaManager_){var d=this.getMediaInformation();this.setStreamType_(d),d.metadata=d.metadata||{title:"",subtitle:"",images:[]},d.metadata.title=a.title?a.title:"",d.metadata.subtitle=a.subtitle?a.subtitle:"",d.metadata.images=a.images?a.images:[],b&&b.program?(d.contentId=b.program.assetId,d.empPayload={assetId:b.program.assetId,programId:b.program.programId,channelId:b.program.channelId},d.customData=d.empPayload):b&&b.asset&&(d.contentId=b.asset.assetId,d.empPayload={assetId:b.asset.assetId},d.customData=d.empPayload),this.assetMetadata_=d.metadata,s.log("updateMediaInformation",d),this.emit(o["default"].METADATA_UPDATED,this.assetMetadata_),this.mediaManager_.setMediaInformation(d,!0)}else this.assetMetadata_.title=a.title?a.title:"",this.assetMetadata_.subtitle=a.subtitle?a.subtitle:"",this.assetMetadata_.images=a.images?a.images:[],this.emit(o["default"].METADATA_UPDATED,this.assetMetadata_);b&&b.program?this.sendMessage({type:t.PROGRAM_CHANGED,data:b}):b&&b.asset&&this.sendMessage({type:t.ASSET_CHANGED,data:b}),setTimeout(function(){c.sendStatus()},1e3)},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):this.mediaManager_.broadcastStatus(!0))},g(a,[{key:"state",get:function(){return this.state_}},{key:"isChromecast",get:function(){return this.isChromecast_}},{key:"version",get:function(){return"2.0.84-98"}},{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)}); | ||
!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){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_())},a.prototype.reset=function(){h.log("empMediaPlayer.reset"),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.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.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){!this.player_.timeShiftEnabled()&&this.player_.isLive()?(a.duration=1/0,a.streamType="LIVE"):(a.duration=Math.round(this.player_.duration()),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_();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_.autoplay(),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&&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.error("No loadRequest in localStorage")}},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(c.currentTime>0&&(d.startTime=c.currentTime),d.startTime=d.absoluteStartTime?0:d.startTime,d.analytics||(d.analytics={}),d.analytics.deviceInfo=this.getAnalyticsDeviceInfo_(),c&&void 0!==c.autoplay&&this.player_.autoplay(c.autoplay),this.player_.options(d),d.volume&&(this.player_.volume(d.volume.level),this.player_.muted(d.volume.muted)),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),this.player_.startPlayback(d.assetId,d.channelId,d.programId,e)},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&&this.player_.analytics().onWindowUnload(),this.onLoadMetadataErrorOrig_(a)},a.prototype.onError_=function(a){try{this.onCastStatusChanged_(u.IDLE),s.log.error(a),this.player_.analytics&&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()?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(){s.log("pull request"),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 a=this.player_.getProgramDetails(),b=this.player_.startTimeLive();a&&(b=a.start.getTime()),this.sendMessage({type:"startTimeLive",data:b}),a&&(a=Object.assign({},a),a.start=void 0,a.end=void 0,this.sendMessage({type:t.PROGRAM_CHANGED,data:{program:a}}));var c=this.player_.getAssetDetails();c&&this.sendMessage({type:t.ASSET_CHANGED,data:{asset:c}});var d=this.player_.entitlement;d&&this.sendMessage({type:t.ENTITLEMENT_CHANGE,data:{entitlement:d}}),this.sendTracks_()},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)):this.sendStatus(a.senderId,a.data.requestId)},a.prototype.onEnded_=function(a){var b=this;s.log("onStop_",a),setTimeout(function(){b.player_.ended()&&(b.onCastStatusChanged_(u.IDLE),b.onEndedOrig_(a))},3e3)},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.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.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.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","Html5"],c.controls=!0,this.options_&&this.options_.controls?c.children=this.options_.controls:c.children={loadingSpinner:{},controlBar:{},mediaLoader:{},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,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_&&(b.sendStatus(b.seekEvent_.senderId,b.seekEvent_.data.requestId),b.seekEvent_=null)}),this.player_.on(t.DURATION_CHANGE,function(){if(b.state_!==u.IDLE){var a=b.player_.getProgramDetails();b.player_.isProgramLive()&&!a&&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_){var a=b.player_.currentSource();if(a.options&&a.options.empcast){var c=b.extractSourceMetadata_(a.options.empcast);b.updateMediaInformation_(c)}}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,!this.loadingState_)}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):this.mediaManager_.broadcastStatus(!0))},g(a,[{key:"state",get:function(){return this.state_}},{key:"isChromecast",get:function(){return this.isChromecast_}},{key:"version",get:function(){return"2.0.86-152"}},{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 |
@@ -76,2 +76,7 @@ # EMP Chromecast Sender version 2 | ||
**contentID** | ||
- *contentID* should be set to assetId (or programId if you don't have access to it). | ||
- if you cast only a channelId then contentID should be set to channelId. | ||
- If you cast a VOD it should be set to assetId. | ||
- If you cast a external stream it should be set to stream url. | ||
@@ -178,4 +183,5 @@ | ||
textTrackStyle: '' // Initial textTrackStyle | ||
startTime: 0, (use playbackProperties instead) // start time in seconds since start of stream, will be override with loadRequest.currentTime | ||
startTime: 0 (use playbackProperties instead) // start time in seconds since start of stream, will be override with loadRequest.currentTime | ||
autoplay: (default is true) // will be override with loadRequest.autoplay | ||
volume: {level: 0-1, muted: true} //initiate volume level. | ||
} | ||
@@ -236,3 +242,3 @@ ``` | ||
```javascript | ||
media:{ "contentId":"766355-726896573_enigma", // asssetId, Note: It's not alway same as programId | ||
media:{ "contentId":"766355-726896573_enigma", // programId or asssetId for VOD | ||
"streamType":"BUFFERED", // StreamType will be BUFFERED even for live streams, to make live streams | ||
@@ -358,3 +364,2 @@ // working with CC build-in controls, if timeshift is disabled it will be "LIVE" to hide progress bar. | ||
**startTimeLive** - returns start time of the live stream. | ||
@@ -368,2 +373,19 @@ ```javascript | ||
**isLive** - If stream is dynamic (even catchup can be live). | ||
```javascript | ||
{ | ||
type: 'isLive', | ||
data: (boolean) | ||
} | ||
``` | ||
**liveDelay** - returns live delay in seconds. | ||
```javascript | ||
{ | ||
type: 'liveDelay', | ||
data: (seconds) | ||
} | ||
``` | ||
**programchanged** - signals a change of program for a given channel. | ||
@@ -447,2 +469,3 @@ <br /> | ||
* isLive | ||
* liveDelay | ||
* startTimeLive | ||
@@ -449,0 +472,0 @@ * programchanged |
{ | ||
"name": "emp-chromecast-receiver-2", | ||
"version": "2.0.85", | ||
"version": "2.0.86-152", | ||
"description": "EMP Receiver v2", | ||
"author": "Joao Coelho <jota.pedro.coelho@gmail.com>", | ||
"main": "./dist/js/emp-receiver.min.js", | ||
"author": "Patrik Carlander", | ||
"license": "Apache-2.0", | ||
"copyright": "Copyright Ericsson, Inc. <https://www.ericsson.com/>", | ||
"repository": { | ||
@@ -7,0 +10,0 @@ "type": "git", |
@@ -153,2 +153,2 @@ # EMP Chromecast Receiver 2 | ||
- [emp-player docs](https://emps-chromecast-receiver.azurewebsites.net/html5-player-2/reference/docs/index.html) | ||
- [emp-player npm](https://www.npmjs.com/package/empplayer2-dev) | ||
- [emp-player npm](https://www.npmjs.com/package/empplayer2) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2502505
42263
0
3