@screwtopmedia/cdf-ng-media
Version:
Angular module for displaying media assets (images, videos)
95 lines (62 loc) • 247 kB
JavaScript
/*!
JW Player version 8.3.2
Copyright (c) 2018, JW Player, All Rights Reserved
https://github.com/jwplayer/jwplayer/blob/v8.3.2/README.md
This source code and its use and distribution is subject to the terms and conditions of the applicable license agreement.
https://www.jwplayer.com/tos/
This product includes portions of other software. For the full text of licenses, see below:
JW Player Third Party Software Notices and/or Additional Terms and Conditions
**************************************************************************************************
The following software is used under Apache License 2.0
**************************************************************************************************
vtt.js v0.13.0
Copyright (c) 2018 Mozilla (http://mozilla.org)
https://github.com/mozilla/vtt.js/blob/v0.13.0/LICENSE
* * *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and
limitations under the License.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************************************
The following software is used under MIT license
**************************************************************************************************
Underscore.js v1.6.0
Copyright (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative
https://github.com/jashkenas/underscore/blob/1.6.0/LICENSE
Backbone backbone.events.js v1.1.2
Copyright (c) 2010-2014 Jeremy Ashkenas, DocumentCloud
https://github.com/jashkenas/backbone/blob/1.1.2/LICENSE
Promise Polyfill v7.1.1
Copyright (c) 2014 Taylor Hakes and Forbes Lindesay
https://github.com/taylorhakes/promise-polyfill/blob/v7.1.1/LICENSE
can-autoplay.js v3.0.0
Copyright (c) 2017 video-dev
https://github.com/video-dev/can-autoplay/blob/v3.0.0/LICENSE
* * *
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************************************
The following software is used under W3C license
**************************************************************************************************
Intersection Observer v0.5.0
Copyright (c) 2016 Google Inc. (http://google.com)
https://github.com/w3c/IntersectionObserver/blob/v0.5.0/LICENSE.md
* * *
W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE
Status: This license takes effect 13 May, 2015.
This work is being provided by the copyright holders under the following license.
License
By obtaining and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
Permission to copy, modify, and distribute this work, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the work or portions thereof, including modifications:
The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software and Document Short Notice should be included.
Notice of any changes or modifications, through a copyright statement on the new code or document such as "This software or document includes material copied from or derived from [title and URI of the W3C document]. Copyright © [YEAR] W3C® (MIT, ERCIM, Keio, Beihang)."
Disclaimers
THIS WORK IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENT WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENT.
The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the work without specific, written prior permission. Title to copyright in this work will at all times remain with copyright holders.
*/
(window.webpackJsonpjwplayer=window.webpackJsonpjwplayer||[]).push([[5,0,2,3,7],[,,,,,,,,,,,,,,,function(e,t,i){"use strict";i.r(t);var n=i(0),o=i(9),a=i(42),r=["repeat","volume","mute","autostart"];var s=i(40),l=i(41),c=i(25),u=i(4),d=i(39),h=i(3),p=i(1),f=i(5),w=i(18),g=i(33);function v(e){var t=!1;return{async:function(){var i=this,n=arguments;return h.b.then(function(){if(!t)return e.apply(i,n)})},cancel:function(){t=!0},cancelled:function(){return t}}}var j=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},m=j;j.prototype=Object(n.h)({},f.a);var b=i(38),y=i(37),k=function(){var e=this,t=void 0,i=void 0;this.mediaModel=new T,this.set("attached",!0),this.set("mediaModel",this.mediaModel),this.setup=function(e){return Object(n.h)(this.attributes,e,y.b),t=new g.a(this.getConfiguration()),this.setAutoStart(),this},this.getConfiguration=function(){var e=this.clone(),t=e.mediaModel.attributes;return Object.keys(y.a).forEach(function(i){e[i]=t[i]}),e.instreamMode=!!e.instream,delete e.instream,delete e.mediaModel,e},this.persistQualityLevel=function(e,t){var i=t[e]||{},o=i.label,a=Object(n.u)(i.bitrate)?i.bitrate:null;this.set("bitrateSelection",a),this.set("qualityLabel",o)},this.setActiveItem=function(e){var t=this.get("playlist")[e];this.resetItem(t),this.attributes.playlistItem=null,this.set("item",e),this.set("minDvrWindow",t.minDvrWindow),this.set("dvrSeekLimit",t.dvrSeekLimit),this.set("playlistItem",t)},this.setMediaModel=function(e){this.mediaModel&&this.mediaModel!==e&&this.mediaModel.off(),e=e||new T,this.mediaModel=e,this.set("mediaModel",e),function(e){var t=e.get("mediaState");e.trigger("change:mediaState",e,t,t)}(e)},this.destroy=function(){this.attributes._destroyed=!0,this.off(),i&&(i.off(null,null,this),i.destroy())},this.getVideo=function(){return i},this.setFullscreen=function(t){(t=!!t)!==e.get("fullscreen")&&e.set("fullscreen",t)},this.getProviders=function(){return t},this.setVolume=function(e){e=Math.round(e),this.set("volume",e);var t=0===e;t!==this.getMute()&&this.setMute(t)},this.getMute=function(){return this.get("autostartMuted")||this.get("mute")},this.setMute=function(e){if(void 0===e&&(e=!this.getMute()),this.set("mute",e),!e){var t=Math.max(10,this.get("volume"));this.set("autostartMuted",!1),this.setVolume(t)}},this.setStreamType=function(e){this.set("streamType",e),"LIVE"===e&&this.setPlaybackRate(1)},this.setProvider=function(e){i=e,x(this,e)},this.resetProvider=function(){i=null,this.set("provider",void 0)},this.setPlaybackRate=function(e){Object(n.r)(e)&&(e=Math.max(Math.min(e,4),.25),"LIVE"===this.get("streamType")&&(e=1),this.set("defaultPlaybackRate",e),i&&i.setPlaybackRate&&i.setPlaybackRate(e))},this.persistCaptionsTrack=function(){var e=this.get("captionsTrack");e?this.set("captionLabel",e.name):this.set("captionLabel","Off")},this.setVideoSubtitleTrack=function(e,t){this.set("captionsIndex",e),e&&t&&e<=t.length&&t[e-1].data&&this.set("captionsTrack",t[e-1])},this.persistVideoSubtitleTrack=function(e,t){this.setVideoSubtitleTrack(e,t),this.persistCaptionsTrack()},this.setAutoStart=function(e){void 0!==e&&this.set("autostart",e);var t=w.OS.mobile&&this.get("autostart");this.set("playOnViewable",t||"viewable"===this.get("autostart"))},this.resetItem=function(e){var t=e?Object(p.f)(e.starttime):0,i=e?Object(p.f)(e.duration):0,n=this.mediaModel;this.set("playRejected",!1),this.attributes.itemMeta={},n.set("position",t),n.set("currentTime",0),n.set("duration",i)},this.persistBandwidthEstimate=function(e){Object(n.u)(e)&&this.set("bandwidthEstimate",e)}},x=function(e,t){e.set("provider",t.getName()),!0===e.get("instreamMode")&&(t.instreamMode=!0),-1===t.getName().name.indexOf("flash")&&(e.set("flashThrottle",void 0),e.set("flashBlocked",!1)),e.setPlaybackRate(e.get("defaultPlaybackRate")),e.set("supportsPlaybackRate",t.supportsPlaybackRate),e.set("playbackRate",t.getPlaybackRate()),e.set("renderCaptionsNatively",t.renderNatively)};var T=k.MediaModel=function(){this.attributes={mediaState:u.Ga}};Object(n.h)(T.prototype,b.a,{srcReset:function(){Object(n.h)(this.attributes,{setup:!1,started:!1,preloaded:!1,visualQuality:null,buffer:0,currentTime:0})}}),Object(n.h)(k.prototype,b.a);var C=k,O=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();var _=function(e){function t(e,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o,a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.attached=!0,a.beforeComplete=!1,a.item=null,a.mediaModel=new T,a.model=i,a.provider=e,a.providerListener=new function(e){return function(t,i){var o=e.mediaModel,a=Object(n.h)({},i,{type:t});switch(t){case u.N:if(o.get(u.N)===i.mediaType)return;o.set(u.N,i.mediaType);break;case u.O:return void o.set(u.O,Object(n.h)({},i));case u.V:i.newstate===u.Ga&&(e.thenPlayPromise.cancel(),o.srcReset());var r=o.attributes.mediaState;return o.attributes.mediaState=i.newstate,void o.trigger("change:mediaState",o,i.newstate,r);case u.A:return e.beforeComplete=!0,e.trigger(u.w,a),void(e.attached&&!e.background&&e._playbackComplete());case u.B:e.thenPlayPromise.cancel(),o.srcReset();break;case u.F:var s=i.duration;Object(n.u)(s)&&(o.set("seekRange",i.seekRange),o.set("duration",s));break;case u.y:o.set("buffer",i.bufferPercent);case u.M:o.set("seekRange",i.seekRange),o.set("position",i.position),o.set("currentTime",i.currentTime);var l=i.duration;Object(n.u)(l)&&o.set("duration",l),Object(n.r)(e.item.starttime)&&delete e.item.starttime;break;case u.D:o.set(u.D,i.levels);case u.E:var c=i.currentQuality,d=i.levels;c>-1&&d.length>1&&o.set("currentLevel",parseInt(c));break;case u.b:o.set(u.b,i.tracks);case u.c:var h=i.currentTrack,p=i.tracks;h>-1&&p.length>0&&h<p.length&&o.set("currentAudioTrack",parseInt(h))}e.trigger(t,a)}}(a),a.thenPlayPromise=v(function(){}),(o=a).provider.on("all",o.providerListener,o),a.eventQueue=new s.a(a,["trigger"],function(){return!a.attached||a.background}),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,m),O(t,[{key:"play",value:function(e){var t=this.item,i=this.model,n=this.mediaModel,o=this.provider;e||(e=i.get("playReason")),i.set("playRejected",!1);var a=h.b;return n.get("setup")?a=o.play()||h.b:(n.set("setup",!0),a=this._loadAndPlay(t,o),n.get("started")||this._playAttempt(a,e)),a}},{key:"stop",value:function(){var e=this.provider;this.beforeComplete=!1,e.stop()}},{key:"pause",value:function(){this.provider.pause()}},{key:"preload",value:function(){var e=this.item,t=this.mediaModel,i=this.provider;!e||e&&"none"===e.preload||!this.attached||this.setup||this.preloaded||(t.set("preloaded",!0),i.preload(e))}},{key:"destroy",value:function(){var e=this.provider,t=this.mediaModel;this.off(),t.off(),e.off(),this.eventQueue.destroy(),this.detach(),e.getContainer()&&e.remove(),delete e.instreamMode,this.provider=null,this.item=null}},{key:"attach",value:function(){var e=this.model,t=this.provider;e.setPlaybackRate(e.get("defaultPlaybackRate")),t.attachMedia(),this.attached=!0,e.set("attached",!0),this.eventQueue.flush(),this.beforeComplete&&this._playbackComplete()}},{key:"detach",value:function(){var e=this.item,t=this.mediaModel,i=this.model,n=this.provider;this.thenPlayPromise.cancel(),n.detachMedia(),this.attached=!1,i.set("attached",!1);var o=t.get("position");o&&(e.starttime=o)}},{key:"_playAttempt",value:function(e,t){var i=this,n=this.item,o=this.mediaModel,a=this.model,r=this.provider;this.trigger(u.H,{item:n,playReason:t}),r&&r.video&&!r.video.paused&&a.set(u.V,u.Da),e.then(function(){o.get("setup")&&(o.set("started",!0),o===a.mediaModel&&(o.off(u.O,null,i),o.change(u.O,function(e,t){t&&i.trigger(u.O,t)},i),function(e){var t=e.get("mediaState");e.trigger("change:mediaState",e,t,t)}(o)))}).catch(function(e){a.set("playRejected",!0),r&&r.video&&r.video.paused&&o.set("mediaState",u.Ia),i.trigger(u.I,{error:e,item:n,playReason:t})})}},{key:"_playbackComplete",value:function(){var e=this.item,t=this.provider;e&&delete e.starttime,this.beforeComplete=!1,t.setState(u.Ea),this.trigger(u.A,{})}},{key:"_loadAndPlay",value:function(){var e=this.item,t=this.provider,i=t.load(e);if(i){var n=v(function(){return t.play()||h.b});return this.thenPlayPromise=n,i.then(n.async)}return t.play()||h.b}},{key:"audioTrack",get:function(){return this.provider.getCurrentAudioTrack()},set:function(e){this.provider.setCurrentAudioTrack(e)}},{key:"quality",get:function(){return this.provider.getCurrentQuality()},set:function(e){this.provider.setCurrentQuality(e)}},{key:"audioTracks",get:function(){return this.provider.getAudioTracks()}},{key:"background",get:function(){var e=this.container,t=this.provider;return!!this.attached&&(!!t.video&&(!e||e&&!e.contains(t.video)))},set:function(e){var t=this.container,i=this.provider;i.video?t&&(e?this.background||(this.thenPlayPromise.cancel(),this.pause(),t.removeChild(i.video),this.container=null):(this.eventQueue.flush(),this.beforeComplete&&this._playbackComplete())):e?this.detach():this.attach()}},{key:"container",get:function(){return this.provider.getContainer()},set:function(e){this.provider.setContainer(e)}},{key:"mediaElement",get:function(){return this.provider.video}},{key:"preloaded",get:function(){return this.mediaModel.get("preloaded")}},{key:"qualities",get:function(){return this.provider.getQualityLevels()}},{key:"setup",get:function(){return this.mediaModel.get("setup")}},{key:"started",get:function(){return this.mediaModel.get("started")}},{key:"activeItem",set:function(e){var t=this.mediaModel=new T,i=e?Object(p.f)(e.starttime):0,n=e?Object(p.f)(e.duration):0,o=t.attributes;t.srcReset(),o.position=i,o.duration=n,this.item=e,this.provider.init(e)}},{key:"controls",set:function(e){this.provider.setControls(e)}},{key:"mute",set:function(e){this.provider.mute(e)}},{key:"position",set:function(e){this.provider.seek(e)}},{key:"subtitles",set:function(e){this.provider.setSubtitlesTrack&&this.provider.setSubtitlesTrack(e)}},{key:"volume",set:function(e){this.provider.volume(e)}}]),t}();var E=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();function M(e){return e&&e.sources&&e.sources[0]}var L=function(e){function t(e,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o,a,r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.adPlaying=!1,r.background=(o=null,a=null,Object.defineProperties({setNext:function(e,t){a={item:e,loadPromise:t}},isNext:function(e){return!(!a||JSON.stringify(a.item.sources[0])!==JSON.stringify(e.sources[0]))},clearNext:function(){a=null}},{nextLoadPromise:{get:function(){return a?a.loadPromise:null}},currentMedia:{get:function(){return o},set:function(e){o=e}}})),r.mediaPool=i,r.mediaController=null,r.mediaControllerListener=function(e,t){return function(i,o){switch(i){case"flashThrottle":var a="resume"!==o.state;e.set("flashThrottle",a),e.set("flashBlocked",a);break;case"flashBlocked":return void e.set("flashBlocked",!0);case"flashUnblocked":return void e.set("flashBlocked",!1);case u.P:return void e.set(i,o[i]);case u.G:return void(e.get("autostartMuted")||e.set(i,o[i]));case u.J:return void e.set("playbackRate",o.playbackRate);case u.F:Object(n.h)(e.get("itemMeta"),o.metadata);break;case u.E:e.persistQualityLevel(o.currentQuality,o.levels);break;case"subtitlesTrackChanged":e.persistVideoSubtitleTrack(o.currentTrack,o.tracks);break;case u.M:case u.K:case u.L:case u.R:case"subtitlesTracks":case"subtitlesTracksData":e.trigger(i,o);break;case u.e:return void e.persistBandwidthEstimate(o.bandwidthEstimate)}t.trigger(i,o)}}(e,r),r.model=e,r.providers=new g.a(e.getConfiguration()),r.loadPromise=h.b,w.Features.backgroundLoading||e.set("mediaElement",r.mediaPool.getPrimedElement()),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,m),E(t,[{key:"setActiveItem",value:function(e){var t=this,i=this.background,n=this.mediaController,o=this.model,a=o.get("playlist")[e];o.attributes.itemReady=!1,o.setActiveItem(e);var r=M(a);if(!r)return h.a.reject(new Error("No media"));if(i.isNext(a))return this._destroyActiveMedia(),this.loadPromise=this._activateBackgroundMedia(),this.loadPromise;if(this._destroyBackgroundMedia(),n){if(o.get("castActive")||this._providerCanPlay(n.provider,r))return this.loadPromise=h.a.resolve(n),n.activeItem=a,this._setActiveMedia(n),this.loadPromise;this._destroyActiveMedia()}var s=o.mediaModel;return this.loadPromise=this._setupMediaController(r).then(function(e){if(s===o.mediaModel)return e.activeItem=a,t._setActiveMedia(e),e}).catch(function(e){throw t._destroyActiveMedia(),e}),this.loadPromise}},{key:"playVideo",value:function(e){var t=this,i=this.mediaController,n=this.model,o=void 0;if(!n.get("playlistItem"))return h.a.reject(new Error("No media"));if(e||(e=n.get("playReason")),i)o=i.play(e);else{n.set(u.V,u.Da);var a=v(function(i){if(t.mediaController&&t.mediaController.mediaModel===i.mediaModel)return i.play(e);throw new Error("Playback cancelled.")});o=this.loadPromise.catch(function(e){throw a.cancel(),n.trigger(u.s,{message:"Could not play video: "+e.message,error:e}),e}).then(a.async)}return o}},{key:"stopVideo",value:function(){var e=this.mediaController,t=this.model,i=t.get("playlist")[t.get("item")];t.attributes.playlistItem=i,t.resetItem(i),e&&e.stop()}},{key:"preloadVideo",value:function(){var e=this.background,t=this.mediaController||e.currentMedia;t&&t.preload()}},{key:"pause",value:function(){var e=this.mediaController;e&&e.pause()}},{key:"castVideo",value:function(e,t){var i=this.model;i.attributes.itemReady=!1;var o=Object(n.h)({},t);o.starttime=i.mediaModel.get("position");var a=new _(e,i);a.activeItem=o,this._setActiveMedia(a)}},{key:"stopCast",value:function(){var e=this.model,t=e.get("item");e.get("playlist")[t].starttime=e.mediaModel.get("position"),this.stopVideo(),this.setActiveItem(t)}},{key:"backgroundActiveMedia",value:function(){this.adPlaying=!0;var e=this.background,t=this.mediaController;t&&(e.currentMedia&&this._destroyMediaController(e.currentMedia),t.background=!0,e.currentMedia=t,this.mediaController=null)}},{key:"restoreBackgroundMedia",value:function(){this.adPlaying=!1;var e=this.background,t=this.mediaController,i=e.currentMedia;if(i){if(t)return this._destroyMediaController(i),void(e.currentMedia=null);i.mediaModel.attributes.mediaState="buffering",this._setActiveMedia(i),i.background=!1,e.currentMedia=null}}},{key:"backgroundLoad",value:function(e){var t=this.background,i=M(e);t.setNext(e,this._setupMediaController(i).then(function(t){return t.activeItem=e,t.preload(),t}).catch(function(){t.clearNext()}))}},{key:"primeMediaElements",value:function(){this.mediaPool.prime()}},{key:"destroy",value:function(){this.off(),this._destroyBackgroundMedia(),this._destroyActiveMedia()}},{key:"_setActiveMedia",value:function(e){var t=this.model,i=e.mediaModel,n=e.provider;!function(e,t){var i=e.get("mediaContainer");i?t.container=i:e.once("change:mediaContainer",function(e,i){t.container=i})}(t,e),this.mediaController=e,t.set("mediaElement",e.mediaElement),t.setMediaModel(i),t.setProvider(n),function(e,t){t.off("all",e.mediaControllerListener,e),t.on("all",e.mediaControllerListener,e)}(this,e),t.set("itemReady",!0)}},{key:"_destroyActiveMedia",value:function(){var e=this.mediaController,t=this.model;e&&(e.detach(),this._destroyMediaController(e),t.resetProvider(),this.mediaController=null)}},{key:"_destroyBackgroundMedia",value:function(){var e=this.background;this._destroyMediaController(e.currentMedia),e.currentMedia=null,this._destroyBackgroundLoadingMedia()}},{key:"_destroyMediaController",value:function(e){var t=this.mediaPool;e&&(t.recycle(e.mediaElement),e.destroy())}},{key:"_setupMediaController",value:function(e){var t=this,i=this.model,n=this.providers,o=function(e){return new _(new e(i.get("id"),i.getConfiguration(),t.primedElement),i)},a=n.choose(e),r=a.provider,s=a.name;return r?h.a.resolve(o(r)):n.load(s).then(function(e){return o(e)})}},{key:"_activateBackgroundMedia",value:function(){var e=this,t=this.background,i=this.background.nextLoadPromise;return this._destroyMediaController(t.currentMedia),t.currentMedia=null,i.then(function(i){if(i)return t.clearNext(),e.adPlaying?t.currentMedia=i:(e._setActiveMedia(i),i.background=!1),i})}},{key:"_destroyBackgroundLoadingMedia",value:function(){var e=this,t=this.background,i=this.background.nextLoadPromise;i&&i.then(function(i){e._destroyMediaController(i),t.clearNext()})}},{key:"_providerCanPlay",value:function(e,t){var i=this.providers.choose(t).provider;return i&&e&&e instanceof i}},{key:"audioTrack",get:function(){var e=this.mediaController;return e?e.audioTrack:-1},set:function(e){var t=this.mediaController;t&&(t.audioTrack=parseInt(e,10)||0)}},{key:"audioTracks",get:function(){var e=this.mediaController;if(e)return e.audioTracks}},{key:"beforeComplete",get:function(){var e=this.mediaController,t=this.background.currentMedia;return!(!e&&!t)&&(e?e.beforeComplete:t.beforeComplete)}},{key:"primedElement",get:function(){return w.Features.backgroundLoading?this.mediaPool.getPrimedElement():this.model.get("mediaElement")}},{key:"quality",get:function(){return this.mediaController?this.mediaController.quality:-1},set:function(e){var t=this.mediaController;t&&(t.quality=parseInt(e,10)||0)}},{key:"qualities",get:function(){var e=this.mediaController;return e?e.qualities:null}},{key:"attached",set:function(e){var t=this.mediaController;t&&(e?t.attach():t.detach())}},{key:"controls",set:function(e){var t=this.mediaController;t&&(t.controls=e)}},{key:"mute",set:function(e){var t=this.background,i=this.mediaController,n=this.mediaPool;i&&(i.mute=e),t.currentMedia&&(t.currentMedia.mute=e),n.syncMute(e)}},{key:"position",set:function(e){var t=this.mediaController;t&&(t.item.starttime=e,t.attached&&(t.position=e))}},{key:"subtitles",set:function(e){var t=this.mediaController;t&&(t.subtitles=e)}},{key:"volume",set:function(e){var t=this.background,i=this.mediaController,n=this.mediaPool;i&&(i.volume=e),t.currentMedia&&(t.currentMedia.volume=e),n.syncVolume(e)}}]),t}();function S(e){return e===u.Ea||e===u.Fa?u.Ga:e}function P(e,t,i){if((t=S(t))!==(i=S(i))){var n=t.replace(/(?:ing|d)$/,""),o={type:n,newstate:t,oldstate:i,reason:e.mediaModel.get("mediaState")};"play"===n?o.playReason=e.get("playReason"):"pause"===n&&(o.pauseReason=e.get("pauseReason")),this.trigger(n,o)}}var A=i(43),I=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),B=function e(t,i,n,o){var a=Object.getOwnPropertyDescriptor(t,i);if(void 0===a){var r=Object.getPrototypeOf(t);null!==r&&e(r,i,n,o)}else if("value"in a&&a.writable)a.value=n;else{var s=a.set;void 0!==s&&s.call(o,n)}return n};var z=function(e){function t(e,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,i)),o=n.model=new C;n.playerModel=e,n.provider=null,o.mediaModel.attributes.mediaType="video";var a=void 0;if(w.Features.backgroundLoading)a=i.getAdElement();else{a=e.get("mediaElement"),o.attributes.mediaElement=a,o.attributes.mediaSrc=a.src;var r=n.srcResetListener=function(){n.srcReset()};a.addEventListener("emptied",r),a.playbackRate=a.defaultPlaybackRate=1}return n.mediaPool=Object(A.a)(a,i),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,L),I(t,[{key:"setup",value:function(){var e=this.model,t=this.playerModel,i=this.primedElement,n=t.attributes,o=t.mediaModel;e.setup({id:n.id,volume:n.volume,instreamMode:!0,edition:n.edition,mediaContext:o,mute:n.mute,streamType:"VOD",autostartMuted:n.autostartMuted,autostart:n.autostart,advertising:n.advertising,sdkplatform:n.sdkplatform,skipButton:!1}),e.on("fullscreenchange",this._nativeFullscreenHandler),e.on("change:state",P,this),e.on(u.s,function(e){this.trigger(u.s,e)},this),i.paused||i.pause()}},{key:"setActiveItem",value:function(e){var i=this;return this.stopVideo(),this.provider=null,function e(t,i,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,i);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,n)}if("value"in o)return o.value;var r=o.get;return void 0!==r?r.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setActiveItem",this).call(this,e).then(function(e){i._setProvider(e.provider)}),this.playVideo()}},{key:"usePsuedoProvider",value:function(e){this.provider=e,e&&(this._setProvider(e),e.off(u.s),e.on(u.s,function(e){this.trigger(u.s,e)},this))}},{key:"_setProvider",value:function(e){var t=this;if(e&&this.mediaPool){var i=this.model,o=this.playerModel,a="vpaid"===e.type;e.off(),e.on("all",function(e,t){a&&e===u.A||this.trigger(e,Object(n.h)({},t,{type:e}))},this);var r=i.mediaModel;e.on(u.V,function(e){r.set("mediaState",e.newstate)}),r.on("change:mediaState",function(e,i){t._stateHandler(i)}),e.attachMedia(),e.volume(o.get("volume")),e.mute(o.getMute()),e.setPlaybackRate&&e.setPlaybackRate(1),o.on("change:volume",function(e,t){this.volume=t},this),o.on("change:mute",function(e,t){this.mute=t,t||(this.volume=o.get("volume"))},this),o.on("change:autostartMuted",function(e,t){t||(i.set("autostartMuted",t),this.mute=o.get("mute"))},this)}}},{key:"destroy",value:function(){var e=this.model,t=this.mediaPool,i=this.playerModel;e.off();var n=t.getPrimedElement();if(w.Features.backgroundLoading){t.clean();var o=i.get("mediaContainer");n.parentNode===o&&o.removeChild(n)}else n&&(n.removeEventListener("emptied",this.srcResetListener),n.src!==e.get("mediaSrc")&&this.srcReset())}},{key:"srcReset",value:function(){var e=this.playerModel,t=e.get("mediaModel"),i=e.getVideo();t.srcReset(),i&&(i.src=null)}},{key:"_nativeFullscreenHandler",value:function(e){this.model.trigger(e.type,e),this.trigger(u.t,{fullscreen:e.jwstate})}},{key:"_stateHandler",value:function(e){var t=this.model;switch(e){case u.Ja:case u.Ia:t.set(u.V,e)}}},{key:"mute",set:function(e){var i=this.mediaController,n=this.model,o=this.provider;n.set("mute",e),B(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"mute",e,this),i||o.mute(e)}},{key:"volume",set:function(e){var i=this.mediaController,n=this.model,o=this.provider;n.set("volume",e),B(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"volume",e,this),i||o.volume(e)}}]),t}(),H={skipoffset:null,tag:null},R=function(e,t,i,o){var a=this,r=this,s=new z(t,o),l=void 0,c=void 0,f=0,w={},g=L,v=!1,j=void 0,m=void 0,b=!1,y=!1,k=!1,x=function(e){b||((e=e||{}).hasControls=!!t.get("controls"),a.trigger(u.u,e),s.model.get("state")===u.Ia?e.hasControls&&s.playVideo():s.pause())},T=function(){b||s.model.get("state")===u.Ia&&t.get("controls")&&(e.setFullscreen(),e.play())};function C(){s.model.set("playRejected",!0)}function O(){f++,r.loadItem(l)}function _(e,t){"complete"!==e&&(t=t||{},w.tag&&!t.tag&&(t.tag=w.tag),this.trigger(e,t),"mediaError"!==e&&"error"!==e||l&&f+1<l.length&&O())}function E(t){var i=t.duration,n=t.position,o=s.model.mediaModel||s.model;o.set("duration",i),o.set("position",n),m||(m=(Object(p.c)(j,i)||i)-d.b),!v&&n>=Math.max(m,d.a)&&(e.preloadNextItem(),v=!0)}function M(e){var t={};w.tag&&(t.tag=w.tag),this.trigger(u.A,t),L.call(this,e)}function L(e){l&&f+1<l.length?O():(e.type===u.A&&this.trigger(u.W,{}),this.destroy())}function S(e){e.width&&e.height&&i.resizeMedia()}this.type="instream",this.addAdProgramTimeListener=function(){if(!y&&!b){s.on(u.M,E,this),t.set("instream",s);var e=i.clickHandler();return e&&e.setAlternateClickHandlers(function(){},null),this}},this.init=function(){if(!y&&!b){y=!0,s.setup(),s.on("all",_,this),s.on(u.I,C,this),s.on(u.M,E,this),s.on(u.A,M,this),s.on(u.F,S,this),e.detachMedia();var n=s.primedElement;t.get("mediaContainer").appendChild(n),t.set("instream",s),s.model.set("state",u.Da);var o=i.clickHandler();return o&&o.setAlternateClickHandlers(function(){},null),this.setText(t.get("localization").loadingAd),k=e.isBeforeComplete()||t.get("state")===u.Ea,this}},this.loadItem=function(e,i){if(b||!y)return h.a.reject(new Error("Instream not setup"));var o=e;Array.isArray(e)?(l=e,c=i||c,e=l[f],c&&(i=c[f])):o=[e];var a=s.model;a.set("playlist",o),t.set("hideAdsControls",!1),e.starttime=0,r.trigger(u.X,{index:f,item:e}),w=Object(n.h)({},H,i),r.addClickHandler(),a.set("skipButton",!1);var d=s.setActiveItem(f);return v=!1,(j=e.skipoffset||w.skipoffset)&&r.setupSkipButton(j,w),d},this.setupSkipButton=function(e,t,i){var n=s.model;g=i||L,n.set("skipMessage",t.skipMessage),n.set("skipText",t.skipText),n.set("skipOffset",e),n.attributes.skipButton=!1,n.set("skipButton",!0)},this.applyProviderListeners=function(e){s.usePsuedoProvider(e),this.addClickHandler()},this.play=function(){s.playVideo()},this.pause=function(){s.pause()},this.addClickHandler=function(){b||i.clickHandler()&&i.clickHandler().setAlternateClickHandlers(x,T)},this.skipAd=function(e){var t=u.a;this.trigger(t,e),g.call(this,{type:t})},this.replacePlaylistItem=function(e){b||(t.set("playlistItem",e),s.srcReset())},this.destroy=function(){b||(b=!0,this.trigger("destroyed"),this.off(),i.clickHandler()&&i.clickHandler().revertAlternateClickHandlers(),t.off(null,null,s),s.off(null,null,r),s.destroy(),y&&s.model&&(t.attributes.state=u.Ia),t.set("instream",null),s=null,y&&!t.attributes._destroyed&&(e.attachMedia(),this.noResume||(k?e.stopVideo():e.playVideo())))},this.getState=function(){return!b&&s.model.get("state")},this.setText=function(e){b||i.setAltText(e||"")},this.hide=function(){b||t.set("hideAdsControls",!0)},this.getMediaElement=function(){return b?null:s.primedElement},this.setSkipOffset=function(e){j=e>0?e:null,s&&s.model.set("skipOffset",j)}};Object(n.h)(R.prototype,f.a);var V=R,N=i(53),F=i(55),D=function(e){var t=this,i=[],n={},o=0;function a(e){if(e.data=e.data||[],e.name=e.label||e.name||e.language,e._id=Object(F.a)(e,i.length),!e.name){var t=Object(F.b)(e,o);e.name=t.label,o=t.unknownCount}n[e._id]=e,i.push(e)}function r(){for(var e=[{id:"off",label:"Off"}],t=0;t<i.length;t++)e.push({id:i[t]._id,label:i[t].name||"Unknown CC"});return e}function s(){var t=0,n=e.get("captionLabel");if("Off"!==n){for(var o=0;o<i.length;o++){var a=i[o];if(n&&n===a.name){t=o+1;break}a.default||a.defaulttrack||"default"===a._id?t=o+1:a.autoselect}var r;r=t,i.length?e.setVideoSubtitleTrack(r,i):e.set("captionsIndex",r)}else e.set("captionsIndex",0)}function l(){var t=r();c(t)!==c(e.get("captionsList"))&&(s(),e.set("captionsList",t))}function c(e){return e.map(function(e){return e.id+"-"+e.label}).join(",")}e.on("change:playlistItem",function(e){i=[],n={},o=0;var t=e.attributes;t.captionsIndex=0,t.captionsList=r(),e.set("captionsTrack",null)},this),e.on("change:itemReady",function(){var i=e.get("playlistItem").tracks,o=i&&i.length;if(o&&!e.get("renderCaptionsNatively"))for(var r=function(e){var o,r=i[e];"subtitles"!==(o=r.kind)&&"captions"!==o||n[r._id]||(a(r),Object(N.c)(r,function(e){!function(e,t){e.data=t}(r,e)},function(e){t.trigger(u.s,{message:"Captions failed to load",reason:e})}))},s=0;s<o;s++)r(s);l()},this),e.on("change:captionsIndex",function(e,t){var n=null;0!==t&&(n=i[t-1]),e.set("captionsTrack",n)},this),this.setSubtitlesTracks=function(e){if(e.length){for(var t=0;t<e.length;t++)a(e[t]);i=Object.keys(n).map(function(e){return n[e]}),l()}},this.getCurrentIndex=function(){return e.get("captionsIndex")},this.getCaptionsList=function(){return e.get("captionsList")},this.destroy=function(){this.off(null,null,this)}};Object(n.h)(D.prototype,f.a);var q=D,U=function(e){return'<div id="'+e+'" class="jwplayer jw-reset jw-state-setup" tabindex="0" aria-label="'+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")+'"><div class="jw-aspect jw-reset"></div><div class="jw-media jw-reset"></div><div class="jw-preview jw-reset"></div><div class="jw-title jw-reset"><div class="jw-title-primary jw-reset"></div><div class="jw-title-secondary jw-reset"></div></div><div class="jw-overlays jw-reset"></div></div>'},W=i(34),Q=44,J=function(e){var t=e.get("height");if(e.get("aspectratio"))return!1;if("string"==typeof t&&t.indexOf("%")>-1)return!1;var i=1*t||NaN;return!!(i=isNaN(i)?e.get("containerHeight"):i)&&(i&&i<=Q)},X="hidden"in document?function(){return!document.hidden}:"webkitHidden"in document?function(){return!document.webkitHidden}:function(){return!0},G=i(49),K=[],Z={},Y=void 0,$=-1;function ee(){Object(G.a)($),$=Object(G.b)(function(){K.forEach(function(e){e.updateBounds()}),K.forEach(function(e){e.model.get("visibility")&&e.updateStyles()}),K.forEach(function(e){e.checkResized()})})}function te(){K.forEach(function(e){e.model.set("activeTab",X())})}document.addEventListener("visibilitychange",te),document.addEventListener("webkitvisibilitychange",te),window.addEventListener("resize",ee),window.addEventListener("orientationchange",ee),window.addEventListener("beforeunload",function(){document.removeEventListener("visibilitychange",te),document.removeEventListener("webkitvisibilitychange",te),window.removeEventListener("resize",ee),window.removeEventListener("orientationchange",ee)});var ie={add:function(e){K.push(e)},remove:function(e){var t=K.indexOf(e);-1!==t&&K.splice(t,1)},size:function(){return K.length},observe:function(e){var t;t=window.IntersectionObserver,Y||(Y=new t(function(e){if(e&&e.length)for(var t=e.length;t--;)for(var i=e[t],n=K.length;n--;){var o=K[n];if(i.target===o.getContainer()){o.model.set("intersectionRatio",i.intersectionRatio);break}}},{threshold:[0,.25,.5,.75,1]})),Z[e.id]||(Z[e.id]=!0,Y.observe(e))},unobserve:function(e){Y&&Z[e.id]&&(delete Z[e.id],Y.unobserve(e))}};function ne(e,t){if(e.get("fullscreen"))return 1;if(!e.get("activeTab"))return 0;var i=e.get("intersectionRatio");return void 0===i&&(i=function(e){var t=document.documentElement,i=document.body,n={top:0,left:0,right:t.clientWidth||i.clientWidth,width:t.clientWidth||i.clientWidth,bottom:t.clientHeight||i.clientHeight,height:t.clientHeight||i.clientHeight};if(!i.contains(e))return 0;if("none"===window.getComputedStyle(e).display)return 0;var o=oe(e);if(!o)return 0;var a=o,r=e.parentNode,s=!1;for(;!s;){var l=null;if(r===i||r===t||1!==r.nodeType?(s=!0,l=n):"visible"!==window.getComputedStyle(r).overflow&&(l=oe(r)),l&&(c=l,u=a,void 0,void 0,void 0,void 0,void 0,void 0,d=Math.max(c.top,u.top),h=Math.min(c.bottom,u.bottom),p=Math.max(c.left,u.left),f=Math.min(c.right,u.right),g=h-d,!(a=(w=f-p)>=0&&g>=0&&{top:d,bottom:h,left:p,right:f,width:w,height:g})))return 0;r=r.parentNode}var c,u,d,h,p,f,w,g;var v=o.width*o.height,j=a.width*a.height;return v?j/v:0}(t)),i}function oe(e){try{return e.getBoundingClientRect()}catch(e){}}var ae=i(52),re=i(19);var se=i(32),le=i(7),ce=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],ue=function(e,t,i){for(var n=e.requestFullscreen||e.webkitRequestFullscreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen,o=t.exitFullscreen||t.webkitExitFullscreen||t.webkitCancelFullScreen||t.mozCancelFullScreen||t.msExitFullscreen,a=!(!n||!o),r=ce.length;r--;)t.addEventListener(ce[r],i);return{events:ce,supportsDomFullscreen:function(){return a},requestFullscreen:function(){n.apply(e)},exitFullscreen:function(){o.apply(t)},fullscreenElement:function(){return t.fullscreenElement||t.webkitCurrentFullScreenElement||t.mozFullScreenElement||t.msFullscreenElement},destroy:function(){for(var e=ce.length;e--;)t.removeEventListener(ce[e],i)}}},de=function(e){var t=!1,i=function(){t=!1,Object(le.j)(e,"jw-no-focus")},n=function(){t=!0,Object(le.a)(e,"jw-no-focus")},o=function(){t||i()};return e.addEventListener("focus",o),e.addEventListener("blur",i),e.addEventListener("mousedown",n),{destroy:function(){e.removeEventListener("focus",o),e.removeEventListener("blur",i),e.removeEventListener("mousedown",n)}}},he=i(47),pe=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();var fe=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object(n.h)(this,f.a),this.revertAlternateClickHandlers(),this.domElement=i,this.model=t,this.ui=new he.a(i,{enableDoubleTap:!0,useMove:!0}).on({"click tap":this.clickHandler,"doubleClick doubleTap":function(){this.alternateDoubleClickHandler?this.alternateDoubleClickHandler():this.trigger("doubleClick")}},this)}return pe(e,[{key:"destroy",value:function(){this.ui&&(this.ui.destroy(),this.ui=this.domElement=this.model=null,this.revertAlternateClickHandlers())}},{key:"clickHandler",value:function(e){this.model.get("flashBlocked")||(this.alternateClickHandler?this.alternateClickHandler(e):this.trigger(e.type===u.j?"click":"tap"))}},{key:"element",value:function(){return this.domElement}},{key:"setAlternateClickHandlers",value:function(e,t){this.alternateClickHandler=e,this.alternateDoubleClickHandler=t||null}},{key:"revertAlternateClickHandlers",value:function(){this.alternateClickHandler=null,this.alternateDoubleClickHandler=null}}]),e}(),we=i(14),ge=void 0,ve={back:!0,backgroundOpacity:50,edgeStyle:null,fontSize:14,fontOpacity:100,fontScale:.05,preprocessor:n.l,windowOpacity:0},je=function(e){var t=this,o=e.player,a=void 0,r=void 0,s=void 0,l=void 0,c=void 0,d=void 0,h=void 0,p=void 0,f=void 0;function g(){Object(n.o)(a.fontSize)&&(o.get("containerHeight")?p=ve.fontScale*a.fontSize/ve.fontSize:o.once("change:containerHeight",g,this))}function v(){var e=o.get("containerHeight");if(e){var t=Math.round(e*p);o.get("renderCaptionsNatively")?function(e,t){f.fontSize=t+"px",Object(re.b)("#"+e+" .jw-video::-webkit-media-text-track-display",f,e,!0)}(o.get("id"),t):Object(re.d)(c,{fontSize:t+"px"})}}function j(e,t,i){var n=Object(re.c)("#000000",i);"dropshadow"===e?t.textShadow="0 2px 1px "+n:"raised"===e?t.textShadow="0 0 5px "+n+", 0 1px 5px "+n+", 0 2px 5px "+n:"depressed"===e?t.textShadow="0 -2px 1px "+n:"uniform"===e&&(t.textShadow="-2px 0 1px "+n+",2px 0 1px "+n+",0 -2px 1px "+n+",0 2px 1px "+n+",-1px 1px 1px "+n+",1px 1px 1px "+n+",1px -1px 1px "+n+",1px 1px 1px "+n)}(c=document.createElement("div")).className="jw-captions jw-reset",this.show=function(){Object(le.a)(c,"jw-captions-enabled")},this.hide=function(){Object(le.j)(c,"jw-captions-enabled")},this.populate=function(e){o.get("renderCaptionsNatively")||(s=[],r=e,e?this.selectCues(e,l):this.renderCues())},this.resize=function(){v(),this.renderCues(!0)},this.renderCues=function(e){e=!!e,ge&&ge.processCues(window,s,c,e)},this.selectCues=function(e,t){if(e&&e.data&&t&&!o.get("renderCaptionsNatively")){var i=this.getAlignmentPosition(e,t);if(!1!==i){var n=this.getCurrentCues(e.data,i);this.updateCurrentCues(n),this.renderCues(!0)}}},this.getCurrentCues=function(e,t){return Object(n.i)(e,function(e){return t>=e.startTime&&(!e.endTime||t<=e.endTime)})},this.updateCurrentCues=function(e){return e.length?Object(n.f)(e,s).length&&(Object(le.a)(d,"jw-captions-window-active"),s=e):s=[],s},this.getAlignmentPosition=function(e,t){var i=e.source,o=t.metadata,a=t.currentTime;return i&&o&&Object(n.r)(o[i])&&(a=o[i]),a},this.clear=function(){Object(le.f)(c)},this.setup=function(e,t){d=document.createElement("div"),h=document.createElement("span"),d.className="jw-captions-window jw-reset",h.className="jw-captions-text jw-reset",a=Object(n.h)({},ve,t),p=ve.fontScale,g(a.fontSize);var i=a.windowColor,r=a.windowOpacity,s=a.edgeStyle;f={};var l={};!function(e,t){var i=t.color,n=t.fontOpacity;(i||n!==ve.fontOpacity)&&(e.color=Object(re.c)(i||"#ffffff",n));if(t.back){var o=t.backgroundColor,a=t.backgroundOpacity;o===ve.backgroundColor&&a===ve.backgroundOpacity||(e.backgroundColor=Object(re.c)(o,a))}else e.background="transparent";t.fontFamily&&(e.fontFamily=t.fontFamily);t.fontStyle&&(e.fontStyle=t.fontStyle);t.fontWeight&&(e.fontWeight=t.fontWeight);t.textDecoration&&(e.textDecoration=t.textDecoration)}(l,a),(i||r!==ve.windowOpacity)&&(f.backgroundColor=Object(re.c)(i||"#000000",r)),j(s,l,a.fontOpacity),a.back||null!==s||j("uniform",l),Object(re.d)(d,f),Object(re.d)(h,l),function(e,t){v(),function(e,t){w.Browser.safari&&Object(re.b)("#"+e+" .jw-video::-webkit-media-text-track-display-backdrop",{backgroundColor:t.backgroundColor},e,!0);Object(re.b)("#"+e+" .jw-video::-webkit-media-text-track-display",f,e,!0),Object(re.b)("#"+e+" .jw-video::cue",t,e,!0)}(e,t),function(e,t){Object(re.b)("#"+e+" .jw-text-track-display",f,e),Object(re.b)("#"+e+" .jw-text-track-cue",t,e)}(e,t)}(e,l),d.appendChild(h),c.appendChild(d),o.change("captionsTrack",function(e,t){this.populate(t)},this),o.set("captions",a)},this.element=function(){return c},this.destroy=function(){o.off(null,null,this),this.off()};var m=function(e){l=e,t.selectCues(r,l)};o.on("change:playlistItem",function(){l=null,s=[]},this),o.on(u.K,function(e){s=[],m(e)},this),o.on(u.M,m,this),o.on("subtitlesTrackData",function(){this.selectCues(r,l)},this),o.on("change:captionsList",function e(t,n){var o=this;1!==n.length&&(t.get("renderCaptionsNatively")||ge||(i.e(8).then(function(e){ge=i(84).default}.bind(null,i)).catch(Object(we.b)(121)).catch(function(e){o.trigger(u.s,{message:"Captions renderer failed to load",reason:e})}),t.off("change:captionsList",e,this)))},this)};Object(n.h)(je.prototype,f.a);var me=je,be=function(e,t){return'<div class="jw-logo jw-logo-'+e+(t?" jw-hide":"")+' jw-reset"></div>'},ye={linktarget:"_blank",margin:8,hide:!1,position:"top-right"};var ke=function(e){this.model=e,this.image=null};Object(n.h)(ke.prototype,{setup:function(e){this.el=e},setImage:function(e){var t=this.image;t&&(t.onload=null),this.image=null;var i="";"string"==typeof e&&(i='url("'+e+'")',(t=this.image=new Image).src=e),Object(re.d)(this.el,{backgroundImage:i})},resize:function(e,t,i){if("uniform"===i){if(e&&(this.playerAspectRatio=e/t),!this.playerAspectRatio||!this.image||"complete"!==(s=this.model.get("state"))&&"idle"!==s&&"error"!==s&&"buffering"!==s)return;var n=this.image,o=null;if(n){if(0===n.width){var a=this;return void(n.onload=function(){a.resize(e,t,i)})}var r=n.width/n.height;Math.abs(this.playerAspectRatio-r)<.09&&(o="cover")}Object(re.d)(this.el,{backgroundSize:o})}var s},element:function(){return this.el}});var xe=ke,Te=function(e){this.model=e.player};Object(n.h)(Te.prototype,{hide:function(){Object(re.d)(this.el,{display:"none"})},show:function(){Object(re.d)(this.el,{display:""})},setup:function(e){this.el=e;var t=this.el.getElementsByTagName("div");this.title=t[0],this.description=t[1],this.model.on("change:logoWidth",this.update,this),this.model.change("playlistItem",this.playlistItem,this)},update:function(e){var t={},i=e.get("logo");if(i){var n=1*(""+i.margin).replace("px",""),o=e.get("logoWidth")+(isNaN(n)?0:n+10);"top-left"===i.position?t.paddingLeft=o:"top-right"===i.position&&(t.paddingRight=o)}Object(re.d)(this.el,t)},playlistItem:function(e,t){if(t)if(e.get("displaytitle")||e.get("displaydescription")){var i="",n="";t.title&&e.get("displaytitle")&&(i=t.title),t.description&&e.get("displaydescription")&&(n=t.description),this.updateText(i,n)}else this.hide()},updateText:function(e,t){this.title.innerHTML=e,this.description.innerHTML=t,this.title.firstChild||this.description.firstChild?this.show():this.hide()},element:function(){return this.el}});var Ce=Te;i(58);var Oe=void 0,_e=w.OS.mobile,Ee=w.Browser.ie;var Me=function(e,t){var i=Object(n.h)(this,f.a,{isSetup:!1,api:e,model:t}),o=Object(le.e)(U(t.get("id"),t.get("localization").player)),a=o.querySelector(".jw-media"),r=new xe(t),s=new Ce(t),l=new me(t);l.on("all",i.trigger,i);var c=void 0,d=void 0,h=void 0,g=-1,v=-1,j=-1,m=void 0,b=void 0,y=void 0,k=null,x=void 0;function T(){Object(G.a)(v),v=Object(G.b)(C)}function C(){i.isSetup&&(i.updateBounds(),i.updateStyles(),i.checkResized())}function O(e,i){var a=J(t);if(Object(n.r)(e)&&Object(n.r)(i)){var r=Object(ae.a)(e);Object(ae.b)(o,r);var s=r<2;Object(le.m)(o,"jw-flag-small-player",s),Object(le.m)(o,"jw-orientation-portrait",i>e)}Object(le.m)(o,"jw-flag-audio-player",a),t.set("audioMode",a)}function _(){t.set("visibility",ne(t,o))}function E(e,t){var n={controls:t};t?(Oe=se.a.controls)?M():(n.loadPromise=Object(se.b)().then(function(t){Oe=t;var i=e.get("controls");return i&&M(),i}),n.loadPromise.catch(function(e){i.trigger(u.s,{message:"Controls failed to load",reason:e})})):i.removeControls(),d&&h&&i.trigger(u.k,n)}function M(){var e=new Oe(document,i.element());i.addControls(e)}function L(e,t,n){t&&!n&&(Y(0,e.get("state")),i.updateStyles())}function S(e){x&&x.mouseMove(e)}function P(e){x&&!x.showing&&"IFRAME"===e.target.nodeName&&x.userActive()}function A(e){x&&x.showing&&e.relatedTarget&&!o.contains(e.relatedTarget)&&x.userActive()}function I(e,t){Object(le.k)(o,/jw-stretch-\S+/,"jw-stretch-"+t)}function B(e,t){Object(le.m)(o,"jw-flag-aspect-mode",!!t);var i=o.querySelector(".jw-aspect");Object(re.d)(i,{paddingTop:t||null})}function z(e,t){Object(le.m)(o,"jw-flag-flash-blocked",t)}function H(i){i.link?(e.pause({reason:"interaction"}),e.setFullscreen(!1),window.open(i.link,i.linktarget)):t.get("controls")&&e.playToggle({reason:"interaction"})}this.updateBounds=function(){Object(G.a)(v);var e=document.body.contains(o),i=Object(le.c)(o),n=Math.round(i.width),a=Math.round(i.height);if(n===d&&a===h)return d&&h||T(),void t.set("inDom",e);n&&a||d&&h||T(),(n||a||e)&&(t.set("containerWidth",n),t.set("containerHeight",a)),t.set("inDom",e),e&&ie.observe(o)},this.updateStyles=function(){var e=t.get("containerWidth"),i=t.get("containerHeight");t.get("controls")&&O(e,i),x&&x.resize(e,i),N(e,i),l.resize()},this.checkResized=function(){var e=t.get("containerWidth"),n=t.get("containerHeight");if(e!==d||n!==h){d=e,h=n,i.trigger(u.Ba,{width:e,height:n});var o=Object(ae.a)(e);k!==o&&(k=o,i.trigger(u.f,{breakpoint:k}))}},this.setup=function(){var d,h,g,v;r.setup(o.querySelector(".jw-preview")),s.setup(o.querySelector(".jw-title")),(c=new function(e){Object(n.h)(this,f.a);var t=void 0,i=void 0,o=new Image;this.setup=function(){if((i=Object(n.h)({},ye,e.get("logo"))).position=i.position||ye.position,i.hide="true"===i.hide.toString(),i.file&&"control-bar"!==i.position){t||(t=Object(le