!function(){var t=window.jwplayer("container");window.CastProviderJS=function(t,e){var i=CastProviderJS.prototype,n=void 0,r=NativeCastProvider,o=t;this.position=0,this.duration=0,i.load=function(t){this.init(t)},i.init=function(t){n!==t&&(void 0!==n&&(o.getPlugin("casting").isResume=!1),n=t,this.setCastMediaItem(t))},i.setCastMediaItem=function(t){var e=o.getPlugin("casting").isResume,i=JSON.stringify(t);if(e){var n=o.getPlugin("casting").playlistIndex;o.set("item",n)}var s=o.get("item"),a=o.get("currentTime");"complete"===o.get("state")&&(s=0,a=0),r.setCastMediaItem(i,s,a,e)},i.loadComplete=function(){o.set("itemReady",!0),o.set("volume",Math.round(100*r.getVolume())),o.set("mute",r.isMuted()),o.trigger("levels",{levels:this.getQualityLevels(),currentQuality:0}),o.trigger("audioTracks",{tracks:[],currentTrack:-1})},i.play=function(){var t=0===this.position&&0===this.duration;if(this.position===this.duration&&!t){var e=JSON.stringify(n),i=o.get("item");o.set("state","buffering"),r.setCastMediaItem(e,i,0,!1)}else r.play();return Promise.resolve()},i.pause=function(){r.pause()},i.seek=function(t){if(this.setState("buffering"),o.trigger("seek",{position:this.getPosition()/1e3,offset:t}),t<0){t+=this.getSeekRange()}r.seek(t)},i.stop=function(){r.stop()},i.mute=function(t){r.mute(t)},i.volume=function(t){r.volume(t)},i.next=function(){r.next()},i.getPosition=function(){return r.getPosition()},i.getDuration=function(){return r.getDuration()},i.getSeekRange=function(){return r.getDuration()},i.destroy=function(){},i.getName=function(){return CastProviderJS.getName()},i.getQualityLevels=function(){return[{label:"Auto"}]},i.setState=function(t){o.set("state",t)},i.triggerSeeked=function(){o.trigger("seeked",{position:this.getPosition()/1e3})},i.triggerVolumeChanged=function(t){o.set("volume",Math.round(100*t))},i.triggerPlaybackRateChanged=function(t){o.set("playbackRate",t)},i.triggerTime=function(t,e,i){var n=Number.parseFloat(t),r=Number.parseFloat(e);if(Number.isFinite(t)){var s=Math.abs(n),a={position:n,duration:r,currentTime:s,seekRange:i,metadata:{currentTime:s}};this.position=n,this.duration=r,o.trigger("time",a)}}},CastProviderJS.supports=function(t){return!1},CastProviderJS.getName=function(){return{name:"CastProviderJS"}},Object.assign(CastProviderJS.prototype,t.Events),jwplayer.api.registerProvider(CastProviderJS)}();
