From 43872456e995708a47369d499c8e26d1bf687848 Mon Sep 17 00:00:00 2001 From: bhh1988 Date: Thu, 11 May 2017 15:56:36 -0700 Subject: [PATCH] Upgrade: Upgrade Shaka-player to 2.1.1 (#110) Changes here: https://github.com/google/shaka-player/releases Notably, the upgrade adds support for asynchronous response filters, which can be used for handling when the token is expired. This commit also modifies DashViewer to use the new player API (getVariantTracks and getTextTracks), instead of the deprecated getTracks and selectTrack methods --- build/karma.conf.js | 2 +- src/lib/constants.js | 2 +- src/lib/viewers/media/DashViewer.js | 8 +- .../media/__tests__/DashViewer-test.js | 12 +- .../media/0.122.0/shaka-player.compiled.js | 366 ++++++++++++++++++ 5 files changed, 378 insertions(+), 12 deletions(-) create mode 100644 src/third-party/media/0.122.0/shaka-player.compiled.js diff --git a/build/karma.conf.js b/build/karma.conf.js index f1b4df62e..72c32f861 100644 --- a/build/karma.conf.js +++ b/build/karma.conf.js @@ -1,7 +1,7 @@ const webpackConfig = require('./webpack.karma.config'); const DOC_STATIC_ASSETS_VERSION = '0.121.1'; -const MEDIA_STATIC_ASSETS_VERSION = '0.120.1'; +const MEDIA_STATIC_ASSETS_VERSION = '0.122.0'; const MODEL3D_STATIC_ASSETS_VERSION = '0.115.0'; const SWF_STATIC_ASSETS_VERSION = '0.112.0'; const TEXT_STATIC_ASSETS_VERSION = '0.114.0'; diff --git a/src/lib/constants.js b/src/lib/constants.js index fa68016e9..43e4f7a61 100644 --- a/src/lib/constants.js +++ b/src/lib/constants.js @@ -74,7 +74,7 @@ export const X_REP_HINT_VIDEO_MP4 = '[mp4]'; // These should be updated to match the Preview version in package.json // whenever a file in that third party directory is updated export const DOC_STATIC_ASSETS_VERSION = '0.121.1'; -export const MEDIA_STATIC_ASSETS_VERSION = '0.120.1'; +export const MEDIA_STATIC_ASSETS_VERSION = '0.122.0'; export const MODEL3D_STATIC_ASSETS_VERSION = '0.115.0'; export const SWF_STATIC_ASSETS_VERSION = '0.112.0'; export const TEXT_STATIC_ASSETS_VERSION = '0.114.0'; diff --git a/src/lib/viewers/media/DashViewer.js b/src/lib/viewers/media/DashViewer.js index a7de143ef..e013e2efb 100644 --- a/src/lib/viewers/media/DashViewer.js +++ b/src/lib/viewers/media/DashViewer.js @@ -165,7 +165,7 @@ class DashViewer extends VideoBaseViewer { * @return {Object|undefined} */ getActiveTrack() { - const tracks = this.player.getTracks(); + const tracks = this.player.getVariantTracks(); return tracks.find((track) => track.active); } @@ -191,7 +191,7 @@ class DashViewer extends VideoBaseViewer { */ enableHD() { this.showLoadingIcon(this.hdRepresentation.id); - this.player.selectTrack(this.hdRepresentation, true); + this.player.selectVariantTrack(this.hdRepresentation, true); } /** @@ -202,7 +202,7 @@ class DashViewer extends VideoBaseViewer { */ enableSD() { this.showLoadingIcon(this.sdRepresentation.id); - this.player.selectTrack(this.sdRepresentation, true); + this.player.selectVariantTrack(this.sdRepresentation, true); } /** @@ -332,7 +332,7 @@ class DashViewer extends VideoBaseViewer { * @return {void} */ calculateVideoDimensions() { - const tracks = this.player.getTracks(); + const tracks = this.player.getVariantTracks(); // Iterate over all available video representations and find the one that // seems the biggest so that the video player is set to the max size diff --git a/src/lib/viewers/media/__tests__/DashViewer-test.js b/src/lib/viewers/media/__tests__/DashViewer-test.js index 06eed5e3a..f1a9e6d15 100644 --- a/src/lib/viewers/media/__tests__/DashViewer-test.js +++ b/src/lib/viewers/media/__tests__/DashViewer-test.js @@ -57,9 +57,9 @@ describe('lib/viewers/media/DashViewer', () => { destroy: () => {}, getNetworkingEngine: sandbox.stub().returns(stubs.networkEngine), getStats: () => {}, - getTracks: () => {}, + getVariantTracks: () => {}, load: () => {}, - selectTrack: () => {} + selectVariantTrack: () => {} }; stubs.mockPlayer = sandbox.mock(dash.player); @@ -207,7 +207,7 @@ describe('lib/viewers/media/DashViewer', () => { it('should get active track', () => { stubs.inactive = { active: false }; stubs.active = { active: true }; - stubs.mockPlayer.expects('getTracks').returns([stubs.inactive, stubs.active]); + stubs.mockPlayer.expects('getVariantTracks').returns([stubs.inactive, stubs.active]); expect(dash.getActiveTrack()).to.equal(stubs.active); }); }); @@ -230,7 +230,7 @@ describe('lib/viewers/media/DashViewer', () => { it('should enable HD video for the file', () => { dash.hdRepresentation = { id: '1' }; sandbox.stub(dash, 'showLoadingIcon'); - stubs.mockPlayer.expects('selectTrack').withArgs(dash.hdRepresentation, true); + stubs.mockPlayer.expects('selectVariantTrack').withArgs(dash.hdRepresentation, true); dash.enableHD(); expect(dash.showLoadingIcon).to.be.calledWith('1'); }); @@ -240,7 +240,7 @@ describe('lib/viewers/media/DashViewer', () => { it('should enable SD video for the file', () => { dash.sdRepresentation = { id: '1' }; sandbox.stub(dash, 'showLoadingIcon'); - stubs.mockPlayer.expects('selectTrack').withArgs(dash.sdRepresentation, true); + stubs.mockPlayer.expects('selectVariantTrack').withArgs(dash.sdRepresentation, true); dash.enableSD(); expect(dash.showLoadingIcon).to.be.calledWith('1'); }); @@ -444,7 +444,7 @@ describe('lib/viewers/media/DashViewer', () => { describe('calculateVideoDimensions()', () => { it('should calculate the video dimensions based on the reps', () => { - stubs.mockPlayer.expects('getTracks').returns([{ width: 200 }, { width: 100 }]); + stubs.mockPlayer.expects('getVariantTracks').returns([{ width: 200 }, { width: 100 }]); dash.calculateVideoDimensions(); expect(dash.hdRepresentation.width).to.equal(200); expect(dash.sdRepresentation.width).to.equal(100); diff --git a/src/third-party/media/0.122.0/shaka-player.compiled.js b/src/third-party/media/0.122.0/shaka-player.compiled.js new file mode 100644 index 000000000..30665c6da --- /dev/null +++ b/src/third-party/media/0.122.0/shaka-player.compiled.js @@ -0,0 +1,366 @@ +(function(){var g={}; +(function(window){var k,aa=this;aa.je=!0;function m(a,b){var c=a.split("."),d=aa;c[0]in d||!d.execScript||d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)c.length||void 0===b?d[e]?d=d[e]:d=d[e]={}:d[e]=b}function ba(a){var b=p;function c(){}c.prototype=b.prototype;a.ne=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.ke=function(a,c,f){return b.prototype[c].apply(a,Array.prototype.slice.call(arguments,2))}};/* + + Copyright 2016 Google Inc. + + 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. +*/ +function ca(a){this.c=Math.exp(Math.log(.5)/a);this.b=this.a=0}function da(a,b,c){var d=Math.pow(a.c,b);c=c*(1-d)+d*a.a;isNaN(c)||(a.a=c,a.b+=b)}function ea(a){return a.a/(1-Math.pow(a.c,a.b))};function fa(){this.c=new ca(2);this.f=new ca(5);this.a=0;this.b=5E5}fa.prototype.setDefaultEstimate=function(a){this.b=a};fa.prototype.getBandwidthEstimate=function(){return 128E3>this.a?this.b:Math.min(ea(this.c),ea(this.f))};function ga(){};function t(a,b,c,d){this.severity=a;this.category=b;this.code=c;this.data=Array.prototype.slice.call(arguments,3)}m("shaka.util.Error",t);t.prototype.toString=function(){return"shaka.util.Error "+JSON.stringify(this,null," ")};t.Severity={RECOVERABLE:1,CRITICAL:2};t.Category={NETWORK:1,TEXT:2,MEDIA:3,MANIFEST:4,STREAMING:5,DRM:6,PLAYER:7,CAST:8,STORAGE:9}; +t.Code={UNSUPPORTED_SCHEME:1E3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,UNKNOWN_DATA_URI_ENCODING:1005,REQUEST_FILTER_ERROR:1006,RESPONSE_FILTER_ERROR:1007,INVALID_TEXT_HEADER:2E3,INVALID_TEXT_CUE:2001,UNABLE_TO_DETECT_ENCODING:2003,BAD_ENCODING:2004,INVALID_XML:2005,INVALID_MP4_TTML:2007,INVALID_MP4_VTT:2008,BUFFER_READ_OUT_OF_BOUNDS:3E3,JS_INTEGER_OVERFLOW:3001,EBML_OVERFLOW:3002,EBML_BAD_FLOATING_POINT_SIZE:3003,MP4_SIDX_WRONG_BOX_TYPE:3004,MP4_SIDX_INVALID_TIMESCALE:3005, +MP4_SIDX_TYPE_NOT_SUPPORTED:3006,WEBM_CUES_ELEMENT_MISSING:3007,WEBM_EBML_HEADER_ELEMENT_MISSING:3008,WEBM_SEGMENT_ELEMENT_MISSING:3009,WEBM_INFO_ELEMENT_MISSING:3010,WEBM_DURATION_ELEMENT_MISSING:3011,WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING:3012,WEBM_CUE_TIME_ELEMENT_MISSING:3013,MEDIA_SOURCE_OPERATION_FAILED:3014,MEDIA_SOURCE_OPERATION_THREW:3015,VIDEO_ERROR:3016,QUOTA_EXCEEDED_ERROR:3017,UNABLE_TO_GUESS_MANIFEST_TYPE:4E3,DASH_INVALID_XML:4001,DASH_NO_SEGMENT_INFO:4002,DASH_EMPTY_ADAPTATION_SET:4003, +DASH_EMPTY_PERIOD:4004,DASH_WEBM_MISSING_INIT:4005,DASH_UNSUPPORTED_CONTAINER:4006,DASH_PSSH_BAD_ENCODING:4007,DASH_NO_COMMON_KEY_SYSTEM:4008,DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED:4009,DASH_CONFLICTING_KEY_IDS:4010,UNPLAYABLE_PERIOD:4011,RESTRICTIONS_CANNOT_BE_MET:4012,NO_PERIODS:4014,HLS_PLAYLIST_HEADER_MISSING:4015,INVALID_HLS_TAG:4016,HLS_INVALID_PLAYLIST_HIERARCHY:4017,DASH_DUPLICATE_REPRESENTATION_ID:4018,HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND:4020,HLS_COULD_NOT_GUESS_MIME_TYPE:4021,HLS_MASTER_PLAYLIST_NOT_PROVIDED:4022, +HLS_REQUIRED_ATTRIBUTE_MISSING:4023,HLS_REQUIRED_TAG_MISSING:4024,HLS_COULD_NOT_GUESS_CODECS:4025,HLS_KEYFORMATS_NOT_SUPPORTED:4026,INVALID_STREAMS_CHOSEN:5005,NO_RECOGNIZED_KEY_SYSTEMS:6E3,REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE:6001,FAILED_TO_CREATE_CDM:6002,FAILED_TO_ATTACH_TO_VIDEO:6003,INVALID_SERVER_CERTIFICATE:6004,FAILED_TO_CREATE_SESSION:6005,FAILED_TO_GENERATE_LICENSE_REQUEST:6006,LICENSE_REQUEST_FAILED:6007,LICENSE_RESPONSE_REJECTED:6008,ENCRYPTED_CONTENT_WITHOUT_DRM_INFO:6010,NO_LICENSE_SERVER_GIVEN:6012, +OFFLINE_SESSION_REMOVED:6013,EXPIRED:6014,LOAD_INTERRUPTED:7E3,CAST_API_UNAVAILABLE:8E3,NO_CAST_RECEIVERS:8001,ALREADY_CASTING:8002,UNEXPECTED_CAST_ERROR:8003,CAST_CANCELED_BY_USER:8004,CAST_CONNECTION_TIMED_OUT:8005,CAST_RECEIVER_APP_UNAVAILABLE:8006,STORAGE_NOT_SUPPORTED:9E3,INDEXED_DB_ERROR:9001,OPERATION_ABORTED:9002,REQUESTED_ITEM_NOT_FOUND:9003,MALFORMED_OFFLINE_URI:9004,CANNOT_STORE_LIVE_OFFLINE:9005,STORE_ALREADY_IN_PROGRESS:9006,NO_INIT_DATA_FOR_OFFLINE:9007};var ha=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;function ia(a){var b;a instanceof ia?(ja(this,a.X),this.xa=a.xa,this.Z=a.Z,ka(this,a.Fa),this.U=a.U,la(this,ma(a.a)),this.qa=a.qa):a&&(b=String(a).match(ha))?(ja(this,b[1]||"",!0),this.xa=na(b[2]||""),this.Z=na(b[3]||"",!0),ka(this,b[4]),this.U=na(b[5]||"",!0),la(this,b[6]||"",!0),this.qa=na(b[7]||"")):this.a=new oa(null)}k=ia.prototype;k.X="";k.xa="";k.Z="";k.Fa=null;k.U="";k.qa=""; +k.toString=function(){var a=[],b=this.X;b&&a.push(qa(b,ra,!0),":");if(b=this.Z){a.push("//");var c=this.xa;c&&a.push(qa(c,ra,!0),"@");a.push(encodeURIComponent(b).replace(/%25([0-9a-fA-F]{2})/g,"%$1"));b=this.Fa;null!=b&&a.push(":",String(b))}if(b=this.U)this.Z&&"/"!=b.charAt(0)&&a.push("/"),a.push(qa(b,"/"==b.charAt(0)?sa:ta,!0));(b=this.a.toString())&&a.push("?",b);(b=this.qa)&&a.push("#",qa(b,ua));return a.join("")}; +k.resolve=function(a){var b=new ia(this);"data"===b.X&&(b=new ia);var c=!!a.X;c?ja(b,a.X):c=!!a.xa;c?b.xa=a.xa:c=!!a.Z;c?b.Z=a.Z:c=null!=a.Fa;var d=a.U;if(c)ka(b,a.Fa);else if(c=!!a.U){if("/"!=d.charAt(0))if(this.Z&&!this.U)d="/"+d;else{var e=b.U.lastIndexOf("/");-1!=e&&(d=b.U.substr(0,e+1)+d)}if(".."==d||"."==d)d="";else if(-1!=d.indexOf("./")||-1!=d.indexOf("/.")){for(var e=!d.lastIndexOf("/",0),d=d.split("/"),f=[],g=0;gb)throw Error("Bad port number "+b);a.Fa=b}else a.Fa=null}function la(a,b,c){b instanceof oa?a.a=b:(c||(b=qa(b,va)),a.a=new oa(b))}function na(a,b){return a?b?decodeURI(a):decodeURIComponent(a):""} +function qa(a,b,c){return"string"==typeof a?(a=encodeURI(a).replace(b,wa),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null}function wa(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)}var ra=/[#\/\?@]/g,ta=/[\#\?:]/g,sa=/[\#\?]/g,va=/[\#\?@]/g,ua=/#/g;function oa(a){this.b=a||null}oa.prototype.a=null;oa.prototype.c=null; +oa.prototype.toString=function(){if(this.b)return this.b;if(!this.a)return"";var a=[],b;for(b in this.a)for(var c=encodeURIComponent(b),d=this.a[b],e=0;e=a[b]}.bind(null,b);if(b[0]||b[2]){if(!b[1]&&!b[3])return Qa(a,!0);if(c(0)&&c(1)&&c(2)&&c(3))return F(a)}else return Qa(a,!1);throw new t(2,2,2003);}m("shaka.util.StringUtils.fromBytesAutoDetect",Ra); +function Sa(a){a=unescape(encodeURIComponent(a));for(var b=new Uint8Array(a.length),c=0;cd||c&&1E3>d)&&!this.a[b].cb&&(this.a.splice(b,1),a.close());Ua(this.A)}};k.yd=function(){Oa(this.M,function(a,b){return"expired"==b})&&this.g(new t(2,6,6014));this.ya(this.M)}; +function ob(){var a=[],b=[{contentType:'video/mp4; codecs="avc1.42E01E"'},{contentType:'video/webm; codecs="vp8"'}],c=[{videoCapabilities:b,persistentState:"required",sessionTypes:["persistent-license"]},{videoCapabilities:b}],d={};"org.w3.clearkey com.widevine.alpha com.microsoft.playready com.apple.fps.2_0 com.apple.fps.1_0 com.apple.fps com.adobe.primetime".split(" ").forEach(function(b){var e=navigator.requestMediaKeySystemAccess(b,c).then(function(a){var c=a.getConfiguration().sessionTypes;d[b]= +{persistentState:c?0<=c.indexOf("persistent-license"):!1};return a.createMediaKeys()})["catch"](function(){d[b]=null});a.push(e)});return Promise.all(a).then(function(){return d})}k.dd=function(){for(var a=0;a=b?null:new VTTCue(a,b,c)}m("shaka.media.TextEngine.makeCue",vb);rb.prototype.m=function(){this.c&&wb(this,function(){return!0});this.c=this.f=null;return Promise.resolve()}; +function xb(a,b,c,d){return Promise.resolve().then(function(){if(this.c)if(null==c||null==d)this.f.parseInit(b);else{for(var a=this.f.parseMedia(b,{periodStart:this.h,segmentStart:c,segmentEnd:d}),f=0;f=this.g);++f)this.c.addCue(a[f]);null==this.b&&(this.b=c);this.a=Math.min(d,this.g)}}.bind(a))} +rb.prototype.remove=function(a,b){return Promise.resolve().then(function(){this.c&&(wb(this,function(c){return c.startTime>=b||c.endTime<=a?!1:!0}),null==this.b||b<=this.b||a>=this.a||(a<=this.b&&b>=this.a?this.b=this.a=null:a<=this.b&&bthis.b&&b>=this.a&&(this.a=a)))}.bind(this))};function wb(a,b){for(var c=a.c.cues,d=[],e=0;ea.end(0)-a.start(0)?null:a.length?a.end(a.length-1):null}function zb(a,b){return!a||!a.length||1==a.length&&1E-6>a.end(0)-a.start(0)?!1:b>=a.start(0)&&b<=a.end(a.length-1)}function Ab(a,b){if(!a||!a.length||1==a.length&&1E-6>a.end(0)-a.start(0))return 0;for(var c=0,d=a.length-1;0<=d&&a.end(d)>b;--d)c+=a.end(d)-Math.max(a.start(d),b);return c};function Bb(a,b,c){this.f=a;this.K=b;this.i=c;this.c={};this.a=null;this.b={};this.g=new D;this.h=!1} +function Cb(){var a={};'video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hvc1.1.6.L93.90",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="av1",audio/webm; codecs="vorbis",audio/webm; codecs="opus",video/mp2t; codecs="avc1.42E01E",video/mp2t; codecs="avc3.42E01E",video/mp2t; codecs="hvc1.1.6.L93.90",video/mp2t; codecs="mp4a.40.2",video/mp2t; codecs="ac-3",video/mp2t; codecs="ec-3",video/mp2t; codecs="mp4a.40.2",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",").forEach(function(b){a[b]=!!sb[b]|| +MediaSource.isTypeSupported(b);var c=b.split(";")[0];a[c]=a[c]||a[b]});return a}k=Bb.prototype;k.m=function(){this.h=!0;var a=[],b;for(b in this.b){var c=this.b[b],d=c[0];this.b[b]=c.slice(0,1);d&&a.push(d.p["catch"](y));for(d=1;dc.end(0)-c.start(0)?null:1==c.length&&0>c.start(0)?0:c.length?c.start(0):null);return c}function Fb(a,b){try{return a.c[b].buffered}catch(c){return null}} +function Gb(a,b,c,d,e){return"text"==b?xb(a.a,c,d,e):Hb(a,b,a.Xd.bind(a,b,c))}k.remove=function(a,b,c){return"text"==a?this.a.remove(b,c):Hb(this,a,this.fc.bind(this,a,b,c))};function Ib(a,b){return"text"==b?a.a.remove(0,Infinity):Hb(a,b,a.fc.bind(a,b,0,a.K.duration))}function Kb(a,b,c,d){if("text"==b)return a.a.h=c,null!=d&&(a.a.g=d),Promise.resolve();null==d&&(d=Infinity);return Promise.all([Hb(a,b,a.tc.bind(a,b)),Hb(a,b,a.Nd.bind(a,b,c)),Hb(a,b,a.Ld.bind(a,b,d))])} +k.endOfStream=function(a){return Lb(this,function(){a?this.K.endOfStream(a):this.K.endOfStream()}.bind(this))};k.ma=function(a){return Lb(this,function(){this.K.duration=a}.bind(this))};k.W=function(){return this.K.duration};k.Xd=function(a,b){this.c[a].appendBuffer(b)};k.fc=function(a,b,c){c<=b?this.Ea(a):this.c[a].remove(b,c)};k.tc=function(a){var b=this.c[a].appendWindowEnd;this.c[a].abort();this.c[a].appendWindowEnd=b;this.Ea(a)};k.Dc=function(a){this.f.currentTime-=.001;this.Ea(a)}; +k.Nd=function(a,b){this.c[a].timestampOffset=b;this.Ea(a)};k.Ld=function(a,b){this.c[a].appendWindowEnd=b+.04;this.Ea(a)};k.Yd=function(a){this.b[a][0].p.reject(new t(2,3,3014,this.f.error?this.f.error.code:0))};k.Ea=function(a){var b=this.b[a][0];b&&(b.p.resolve(),Mb(this,a))}; +function Hb(a,b,c){if(a.h)return Promise.reject();c={start:c,p:new A};a.b[b].push(c);if(1==a.b[b].length)try{c.start()}catch(d){"QuotaExceededError"==d.name?c.p.reject(new t(2,3,3017,b)):c.p.reject(new t(2,3,3015,d)),Mb(a,b)}return c.p} +function Lb(a,b){if(a.h)return Promise.reject();var c=[],d;for(d in a.c){var e=new A,f={start:function(a){a.resolve()}.bind(null,e),p:e};a.b[d].push(f);c.push(e);1==a.b[d].length&&f.start()}return Promise.all(c).then(function(){var a,c;try{b()}catch(l){c=Promise.reject(new t(2,3,3015,l))}for(a in this.c)Mb(this,a);return c}.bind(a),function(){return Promise.reject()}.bind(a))}function Mb(a,b){a.b[b].shift();var c=a.b[b][0];if(c)try{c.start()}catch(d){c.p.reject(new t(2,3,3015,d)),Mb(a,b)}};function Nb(a,b,c){return c==b||a>=Ob&&c==b.split("-")[0]||a>=Pb&&c.split("-")[0]==b.split("-")[0]?!0:!1}var Ob=1,Pb=2;function Qb(a){a=a.toLowerCase().split("-");var b=Rb[a[0]];b&&(a[0]=b);return a.join("-")} +var Rb={aar:"aa",abk:"ab",afr:"af",aka:"ak",alb:"sq",amh:"am",ara:"ar",arg:"an",arm:"hy",asm:"as",ava:"av",ave:"ae",aym:"ay",aze:"az",bak:"ba",bam:"bm",baq:"eu",bel:"be",ben:"bn",bih:"bh",bis:"bi",bod:"bo",bos:"bs",bre:"br",bul:"bg",bur:"my",cat:"ca",ces:"cs",cha:"ch",che:"ce",chi:"zh",chu:"cu",chv:"cv",cor:"kw",cos:"co",cre:"cr",cym:"cy",cze:"cs",dan:"da",deu:"de",div:"dv",dut:"nl",dzo:"dz",ell:"el",eng:"en",epo:"eo",est:"et",eus:"eu",ewe:"ee",fao:"fo",fas:"fa",fij:"fj",fin:"fi",fra:"fr",fre:"fr", +fry:"fy",ful:"ff",geo:"ka",ger:"de",gla:"gd",gle:"ga",glg:"gl",glv:"gv",gre:"el",grn:"gn",guj:"gu",hat:"ht",hau:"ha",heb:"he",her:"hz",hin:"hi",hmo:"ho",hrv:"hr",hun:"hu",hye:"hy",ibo:"ig",ice:"is",ido:"io",iii:"ii",iku:"iu",ile:"ie",ina:"ia",ind:"id",ipk:"ik",isl:"is",ita:"it",jav:"jv",jpn:"ja",kal:"kl",kan:"kn",kas:"ks",kat:"ka",kau:"kr",kaz:"kk",khm:"km",kik:"ki",kin:"rw",kir:"ky",kom:"kv",kon:"kg",kor:"ko",kua:"kj",kur:"ku",lao:"lo",lat:"la",lav:"lv",lim:"li",lin:"ln",lit:"lt",ltz:"lb",lub:"lu", +lug:"lg",mac:"mk",mah:"mh",mal:"ml",mao:"mi",mar:"mr",may:"ms",mkd:"mk",mlg:"mg",mlt:"mt",mon:"mn",mri:"mi",msa:"ms",mya:"my",nau:"na",nav:"nv",nbl:"nr",nde:"nd",ndo:"ng",nep:"ne",nld:"nl",nno:"nn",nob:"nb",nor:"no",nya:"ny",oci:"oc",oji:"oj",ori:"or",orm:"om",oss:"os",pan:"pa",per:"fa",pli:"pi",pol:"pl",por:"pt",pus:"ps",que:"qu",roh:"rm",ron:"ro",rum:"ro",run:"rn",rus:"ru",sag:"sg",san:"sa",sin:"si",slk:"sk",slo:"sk",slv:"sl",sme:"se",smo:"sm",sna:"sn",snd:"sd",som:"so",sot:"st",spa:"es",sqi:"sq", +srd:"sc",srp:"sr",ssw:"ss",sun:"su",swa:"sw",swe:"sv",tah:"ty",tam:"ta",tat:"tt",tel:"te",tgk:"tg",tgl:"tl",tha:"th",tib:"bo",tir:"ti",ton:"to",tsn:"tn",tso:"ts",tuk:"tk",tur:"tr",twi:"tw",uig:"ug",ukr:"uk",urd:"ur",uzb:"uz",ven:"ve",vie:"vi",vol:"vo",wel:"cy",wln:"wa",wol:"wo",xho:"xh",yid:"yi",yor:"yo",zha:"za",zho:"zh",zul:"zu"};function Sb(a,b,c){var d=a.video;return d&&(d.widthb.maxWidth||d.width>c.width||d.heightb.maxHeight||d.height>c.height||d.width*d.heightb.maxPixels)||a.bandwidthb.maxBandwidth?!1:!0}function Tb(a,b,c){var d=!1;a.variants.forEach(function(a){var e=a.allowedByApplication;a.allowedByApplication=Sb(a,b,c);e!=a.allowedByApplication&&(d=!0)});return d} +function Ub(a,b,c){var d=b.video,e=b.audio;for(b=0;bd.indexOf(b)||c&&(a.mimeType!=c.mimeType||a.codecs.split(".")[0]!=c.codecs.split(".")[0])?!1:!0} +function Xb(a,b,c){return Yb(a.variants).map(function(a){var d;a.video&&a.audio?d=c==a.video.id&&b==a.audio.id:d=a.video&&c==a.video.id||a.audio&&b==a.audio.id;var f="";a.video&&(f+=a.video.codecs);a.audio&&(""!=f&&(f+=", "),f+=a.audio.codecs);var g=a.audio?a.audio.codecs:null,h=a.video?a.video.codecs:null,l=null;a.video?l=a.video.mimeType:a.audio&&(l=a.audio.mimeType);var n=null;a.audio?n=a.audio.kind:a.video&&(n=a.video.kind);return{id:a.id,active:d,type:"variant",bandwidth:a.bandwidth,language:a.language, +kind:n||null,width:a.video?a.video.width:null,height:a.video?a.video.height:null,frameRate:a.video?a.video.frameRate:void 0,mimeType:l,codecs:f,audioCodec:g,videoCodec:h,primary:a.primary}})}function Zb(a,b){return a.textStreams.map(function(a){return{id:a.id,active:b==a.id,type:"text",language:a.language,kind:a.kind,mimeType:a.mimeType,codecs:a.codecs||null,audioCodec:null,videoCodec:null,primary:a.primary}})} +function $b(a,b){for(var c=0;c=a.periods[c].startTime)return c;return 0} +function gc(a,b){for(var c=0;c=g.bandwidth/.95&&e<=h&&(d=g)}(c=d)&&c.video&&(b.video=c.video);c&&c.audio&&(b.audio=c.audio)}-1b)){var d=8E3*b/a,e=a/1E3;c.a+=b;da(c.c,e,d);da(c.f,e,d)}if(null!=this.c&&this.b)a:{if(!this.j){if(!(128E3<=this.a.a))break a;this.j=!0}else if(8E3>Date.now()-this.c)break a;c=this.chooseStreams(["audio","video"]);this.a.getBandwidthEstimate();this.f(c)}}; +G.prototype.segmentDownloaded=G.prototype.segmentDownloaded;G.prototype.getBandwidthEstimate=function(){return this.a.getBandwidthEstimate()};G.prototype.getBandwidthEstimate=G.prototype.getBandwidthEstimate;G.prototype.setDefaultEstimate=function(a){this.a.setDefaultEstimate(a)};G.prototype.setDefaultEstimate=G.prototype.setDefaultEstimate;G.prototype.setRestrictions=function(a){this.i=a};G.prototype.setRestrictions=G.prototype.setRestrictions;G.prototype.setVariants=function(a){this.h=a}; +G.prototype.setVariants=G.prototype.setVariants;G.prototype.setTextStreams=function(a){this.g=a};G.prototype.setTextStreams=G.prototype.setTextStreams;function hc(a,b){return b.filter(function(b){return Sb(b,a,{width:Infinity,height:Infinity})}).sort(function(a,b){return a.bandwidth-b.bandwidth})};function H(a,b){var c=b||{},d;for(d in c)this[d]=c[d];this.defaultPrevented=this.cancelable=this.bubbles=!1;this.timeStamp=window.performance&&window.performance.now?window.performance.now():Date.now();this.type=a;this.isTrusted=!1;this.target=this.currentTarget=null;this.a=!1}H.prototype.preventDefault=function(){this.cancelable&&(this.defaultPrevented=!0)};H.prototype.stopImmediatePropagation=function(){this.a=!0};H.prototype.stopPropagation=function(){};var ic="ended play playing pause pausing ratechange seeked seeking timeupdate volumechange".split(" "),jc="buffered currentTime duration ended loop muted paused playbackRate seeking videoHeight videoWidth volume".split(" "),kc=["loop","playbackRate"],lc=["pause","play"],mc="adaptation buffering emsg error loading unloading texttrackvisibility timelineregionadded timelineregionenter timelineregionexit trackschanged".split(" "),nc="drmInfo getAudioLanguages getConfiguration getExpiration getManifestUri getPlaybackRate getPlayheadTimeAsDate getTextLanguages getTextTracks getTracks getStats getVariantTracks isBuffering isInProgress isLive isTextTrackVisible keySystem seekRange".split(" "), +oc=[["getConfiguration","configure"]],pc=[["isTextTrackVisible","setTextTrackVisibility"]],qc="addTextTrack cancelTrickPlay configure resetConfiguration selectAudioLanguage selectTextLanguage selectTextTrack selectTrack selectVariantTrack setTextTrackVisibility trickPlay".split(" "),rc=["load","unload"]; +function sc(a){return JSON.stringify(a,function(a,c){if("manager"!=a&&"function"!=typeof c){if(c instanceof Event||c instanceof H){var b={},e;for(e in c){var f=c[e];f&&"object"==typeof f||e in Event||(b[e]=f)}return b}if(c instanceof TimeRanges)for(b={__type__:"TimeRanges",length:c.length,start:[],end:[]},e=0;ec?"-Infinity":"Infinity":c;return b}})} +function tc(a){return JSON.parse(a,function(a,c){return"NaN"==c?NaN:"-Infinity"==c?-Infinity:"Infinity"==c?Infinity:c&&"object"==typeof c&&"TimeRanges"==c.__type__?uc(c):c})}function uc(a){return{length:a.length,start:function(b){return a.start[b]},end:function(b){return a.end[b]}}};function vc(a,b,c,d,e){this.I=a;this.l=b;this.B=c;this.F=d;this.v=e;this.c=this.j=this.h=!1;this.A="";this.a=this.i=null;this.b={video:{},player:{}};this.o=0;this.f={};this.g=null}k=vc.prototype;k.m=function(){wc(this);this.a&&(this.a.leave(function(){},function(){}),this.a=null);this.F=this.B=this.l=null;this.c=this.j=this.h=!1;this.g=this.f=this.b=this.i=null;return Promise.resolve()};k.T=function(){return this.c};k.wb=function(){return this.A}; +k.init=function(){if(window.chrome&&chrome.cast&&chrome.cast.isAvailable){delete window.__onGCastApiAvailable;this.h=!0;this.l();var a=new chrome.cast.SessionRequest(this.I),a=new chrome.cast.ApiConfig(a,this.Vc.bind(this),this.fd.bind(this),"origin_scoped");chrome.cast.initialize(a,function(){},function(){})}else window.__onGCastApiAvailable=function(a){a&&this.init()}.bind(this)};k.zb=function(a){this.i=a;this.c&&xc(this,{type:"appData",appData:this.i})}; +k.cast=function(a){if(!this.h)return Promise.reject(new t(1,8,8E3));if(!this.j)return Promise.reject(new t(1,8,8001));if(this.c)return Promise.reject(new t(1,8,8002));this.g=new A;chrome.cast.requestSession(this.ub.bind(this,a),this.Ub.bind(this));return this.g};k.Va=function(){this.c&&(wc(this),this.a&&(this.a.stop(function(){},function(){}),this.a=null))}; +k.get=function(a,b){if("video"==a){if(0<=lc.indexOf(b))return this.ec.bind(this,a,b)}else if("player"==a){if(0<=qc.indexOf(b))return this.ec.bind(this,a,b);if(0<=rc.indexOf(b))return this.Cd.bind(this,a,b);if(0<=nc.indexOf(b))return this.cc.bind(this,a,b)}return this.cc(a,b)};k.set=function(a,b,c){this.b[a][b]=c;xc(this,{type:"set",targetName:a,property:b,value:c})}; +k.ub=function(a,b){this.a=b;this.a.addUpdateListener(this.Vb.bind(this));this.a.addMessageListener("urn:x-cast:com.google.shaka.v2",this.$c.bind(this));this.Vb();xc(this,{type:"init",initState:a,appData:this.i});this.g.resolve()};k.Ub=function(a){var b=8003;switch(a.code){case "cancel":b=8004;break;case "timeout":b=8005;break;case "receiver_unavailable":b=8006}this.g.reject(new t(2,8,b,a))};k.cc=function(a,b){return this.b[a][b]}; +k.ec=function(a,b){xc(this,{type:"call",targetName:a,methodName:b,args:Array.prototype.slice.call(arguments,2)})};k.Cd=function(a,b){var c=Array.prototype.slice.call(arguments,2),d=new A,e=this.o.toString();this.o++;this.f[e]=d;xc(this,{type:"asyncCall",targetName:a,methodName:b,args:c,id:e});return d};k.Vc=function(a){var b=this.v();this.g=new A;this.ub(b,a)};k.fd=function(a){this.j="available"==a;this.l()}; +k.Vb=function(){var a=this.a?"connected"==this.a.status:!1;if(this.c&&!a){this.F();for(var b in this.b)this.b[b]={};wc(this)}this.A=(this.c=a)?this.a.receiver.friendlyName:"";this.l()};function wc(a){for(var b in a.f){var c=a.f[b];delete a.f[b];c.reject(new t(1,7,7E3))}} +k.$c=function(a,b){var c=tc(b);switch(c.type){case "event":var d=c.targetName,e=c.event;this.B(d,new H(e.type,e));break;case "update":e=c.update;for(d in e){var c=this.b[d]||{},f;for(f in e[d])c[f]=e[d][f]}break;case "asyncComplete":if(d=c.id,f=c.error,c=this.f[d],delete this.f[d],c)if(f){d=new t(f.severity,f.category,f.code);for(e in f)d[e]=f[e];c.reject(d)}else c.resolve()}};function xc(a,b){var c=sc(b);a.a.sendMessage("urn:x-cast:com.google.shaka.v2",c,function(){},ga)};function p(){this.gb=new Ha;this.Oa=this}p.prototype.addEventListener=function(a,b){this.gb.push(a,b)};p.prototype.removeEventListener=function(a,b){this.gb.remove(a,b)};p.prototype.dispatchEvent=function(a){for(var b=this.gb.get(a.type)||[],c=0;cu)if(v+1=u)break;u=Math.ceil((u-w)/K)-1}else{if(Infinity==n)break;else if(w/e>=n)break;u=Math.ceil((n*e-w)/K)-1}0a.H.byteLength&&bd();var c=a.H.buffer.slice(a.u,a.u+b);a.u+=b;return new Uint8Array(c)}function P(a,b){a.u+b>a.H.byteLength&&bd();a.u+=b}function fd(a){for(var b=a.u;$c(a)&&a.H.getUint8(a.u);)a.u+=1;b=a.H.buffer.slice(b,a.u);a.u+=1;return F(b)} +function bd(){throw new t(2,3,3E3);};function Q(){this.b=[];this.a=[]}m("shaka.util.Mp4Parser",Q);Q.prototype.C=function(a,b){var c=gd(a);this.b[c]=0;this.a[c]=b;return this};Q.prototype.box=Q.prototype.C;Q.prototype.$=function(a,b){var c=gd(a);this.b[c]=1;this.a[c]=b;return this};Q.prototype.fullBox=Q.prototype.$;Q.prototype.parse=function(a){for(a=new Yc(new DataView(a));$c(a);)this.Za(0,a)};Q.prototype.parse=Q.prototype.parse; +Q.prototype.Za=function(a,b){var c=b.u,d=O(b),e=O(b);switch(d){case 0:d=b.H.byteLength-c;break;case 1:d=dd(b)}var f=this.a[e];if(f){var g=null,h=null;1==this.b[e]&&(h=O(b),g=h>>>24,h&=16777215);e=c+d-b.u;e=0>>31;var n=n&2147483647,q=O(d.s);P(d.s,4);if(1==g)throw new t(2,3,3006);e.push(new N(e.length,b/f,(b+q)/f,function(){return c},a,a+n-1));b+=q;a+=n}return e};function S(a){this.a=a}m("shaka.media.SegmentIndex",S);S.prototype.m=function(){this.a=null;return Promise.resolve()};S.prototype.destroy=S.prototype.m;S.prototype.find=function(a){for(var b=this.a.length-1;0<=b;--b){var c=this.a[b];if(a>=c.startTime&&aa||a>=this.a.length?null:this.a[a]}; +S.prototype.get=S.prototype.get;S.prototype.qb=function(a){for(var b=[],c=0,d=0;cf.startTime||(.1a);++b);this.a.splice(0,b)};S.prototype.evict=S.prototype.jb;function ld(a,b){if(a.a.length){var c=a.a[a.a.length-1];c.startTime>b||(a.a[a.a.length-1]=new N(c.position,c.startTime,b,c.a,c.V,c.J))}};function md(a){this.b=a;this.a=new Yc(a);nd||(nd=[new Uint8Array([255]),new Uint8Array([127,255]),new Uint8Array([63,255,255]),new Uint8Array([31,255,255,255]),new Uint8Array([15,255,255,255,255]),new Uint8Array([7,255,255,255,255,255]),new Uint8Array([3,255,255,255,255,255,255]),new Uint8Array([1,255,255,255,255,255,255,255])])}var nd; +function od(a){var b;b=pd(a);if(7=c&&!(b&1<<8-c);c++);if(8a||c&&a>=c?null:Math.floor(a/d)},getSegmentReference:function(a){var b=a*d;return 0>b||c&&b>=c?null:new N(a,b,b+d,function(){var c=Tc(g,l,a+e,h,b*f);return z(n,[c])},0,null)}}} +function Hd(a,b){for(var c=[],d=0;da.l||(a.f=window.setTimeout(a.Wd.bind(a),1E3*Math.max(Math.max(3,a.l)-b,0)))} +function Td(a,b,c){b=b||{contentType:"",mimeType:"",codecs:"",containsEmsgBoxes:!1,frameRate:void 0};c=c||b.S;var d=L(a,"BaseURL").map(Gc),e=a.getAttribute("contentType")||b.contentType,f=a.getAttribute("mimeType")||b.mimeType,g=a.getAttribute("codecs")||b.codecs,h=M(a,"frameRate",Nc)||b.frameRate,l=!!L(a,"InbandEventStream").length;e||(e=Wd(f,g));return{S:z(c,d),La:Fc(a,"SegmentBase")||b.La,la:Fc(a,"SegmentList")||b.la,Ma:Fc(a,"SegmentTemplate")||b.Ma,width:M(a,"width",Mc)||b.width,height:M(a,"height", +Mc)||b.height,contentType:e,mimeType:f,codecs:g,frameRate:h,containsEmsgBoxes:l||b.containsEmsgBoxes,id:a.getAttribute("id")}}function Xd(a){var b;b=0+(a.La?1:0);b+=a.la?1:0;b+=a.Ma?1:0;if(!b)return"text"==a.contentType||"application"==a.contentType?!0:!1;1!=b&&(a.La&&(a.la=null),a.Ma=null);return!0} +function Yd(a,b,c,d){b=z(b,[c]);b=C(b,a.b.retryParameters);b.method=d;return a.a.networkingEngine.request(0,b).then(function(a){if("HEAD"==d){if(!a.headers||!a.headers.date)return 0;a=a.headers.date}else a=F(a.data);a=Date.parse(a);return isNaN(a)?0:a-Date.now()})} +function Rd(a,b,c,d){c=c.map(function(a){return{scheme:a.getAttribute("schemeIdUri"),value:a.getAttribute("value")}});var e=a.b.dash.clockSyncUri;d&&!c.length&&e&&c.push({scheme:"urn:mpeg:dash:utc:http-head:2014",value:e});return xa(c,function(a){var c=a.value;switch(a.scheme){case "urn:mpeg:dash:utc:http-head:2014":case "urn:mpeg:dash:utc:http-head:2012":return Yd(this,b,c,"HEAD");case "urn:mpeg:dash:utc:http-xsdate:2014":case "urn:mpeg:dash:utc:http-iso:2014":case "urn:mpeg:dash:utc:http-xsdate:2012":case "urn:mpeg:dash:utc:http-iso:2012":return Yd(this, +b,c,"GET");case "urn:mpeg:dash:utc:direct:2014":case "urn:mpeg:dash:utc:direct:2012":return a=Date.parse(c),isNaN(a)?0:a-Date.now();case "urn:mpeg:dash:utc:http-ntp:2014":case "urn:mpeg:dash:utc:ntp:2014":case "urn:mpeg:dash:utc:sntp:2014":return Promise.reject();default:return Promise.reject()}}.bind(a))["catch"](function(){return 0})} +k.td=function(a,b,c){var d=c.getAttribute("schemeIdUri")||"",e=c.getAttribute("value")||"",f=M(c,"timescale",Mc)||1;L(c,"Event").forEach(function(c){var g=M(c,"presentationTime",Mc)||0,l=M(c,"duration",Mc)||0,g=g/f+a,l=g+l/f;null!=b&&(g=Math.min(g,a+b),l=Math.min(l,a+b));c={schemeIdUri:d,value:e,startTime:g,endTime:l,id:c.getAttribute("id")||"",eventElement:c};this.a.onTimelineRegionAdded(c)}.bind(this))}; +k.Ed=function(a,b,c){a=C(a,this.b.retryParameters);null!=b&&(a.headers.Range="bytes="+b+"-"+(null!=c?c:""));return this.a.networkingEngine.request(1,a).then(function(a){return a.data})};function Wd(a,b){return sb[Wb(a,b)]?"text":a.split("/")[0]}Jd.mpd=Md;Id["application/dash+xml"]=Md;function Zd(a,b,c,d){this.uri=a;this.type=b;this.da=c;this.segments=d||null}function $d(a,b,c,d){this.id=a;this.name=b;this.a=c;this.value=d||null}$d.prototype.toString=function(){function a(a){return a.name+'="'+a.value+'"'}return this.value?"#"+this.name+":"+this.value:0b.length||"data"!=b[0])throw new t(2,1,1004,a);b=b.slice(1).join(":").split(",");if(2>b.length)throw new t(2,1,1004,a);var c=b[0],b=window.decodeURIComponent(b.slice(1).join(",")),c=c.split(";"),d=null;1c.length)return null;var d=null,e=a;for(a=null;e&&!(a=e.getAttribute(b))&&(e=e.parentNode,e instanceof Element););if(b=a)for(a=0;ah[0].indexOf("--\x3e")&&(g=h[0],h.splice(0,1));var n=new fe(h[0]),q=ef(n),r=ge(n,/[ \t]+--\x3e[ \t]+/g),v=ef(n);if(null==q||!r||null==v)throw new t(2,2,2001);if(h=vb(q+l,v+l,h.slice(1).join("\n").trim())){ge(n,/[ \t]+/gm);for(l=he(n);l;)ff(h,l),ge(n,/[ \t]+/gm),l=he(n);null!=g&&(h.id=g);g=h}else g=null}g&&f.push(g)}return f}; +function ff(a,b){var c;if(c=/^align:(start|middle|center|end|left|right)$/.exec(b))a.align=c[1],"center"==c[1]&&"center"!=a.align&&(a.position="auto",a.align="middle");else if(c=/^vertical:(lr|rl)$/.exec(b))a.vertical=c[1];else if(c=/^size:(\d{1,2}|100)%$/.exec(b))a.size=Number(c[1]);else if(c=/^position:(\d{1,2}|100)%(?:,(line-left|line-right|center|start|end))?$/.exec(b))a.position=Number(c[1]),c[2]&&(a.positionAlign=c[2]);else if(c=/^line:(\d{1,2}|100)%(?:,(start|end|center))?$/.exec(b))a.snapToLines= +!1,a.line=Number(c[1]),c[2]&&(a.lineAlign=c[2]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.snapToLines=!0,a.line=Number(c[1]),c[2]&&(a.lineAlign=c[2])}function ef(a){a=ge(a,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3})/g);if(!a)return null;var b=Number(a[2]),c=Number(a[3]);return 59a.W()?a.ja():a.Xa()}k.kb=function(){return this.g}; +function pf(a,b){null!=a.f&&(window.clearInterval(a.f),a.f=null);a.g=b;a.a.playbackRate=a.h||0>b?0:b;!a.h&&0>b&&(a.f=window.setInterval(function(){this.a.currentTime+=b/4}.bind(a),250))}k.tb=function(){this.o=!0;this.Zb()};k.ed=function(){this.a.playbackRate!=(this.h||0>this.g?0:this.g)&&pf(this,this.a.playbackRate)}; +k.Xb=function(){var a=of(this);.001>Math.abs(this.a.currentTime-a)?(E(this.b,this.a,"seeking",this.$b.bind(this)),E(this.b,this.a,"playing",this.Yb.bind(this))):(Ka(this.b,this.a,"seeking",this.gd.bind(this)),this.a.currentTime=a)};k.gd=function(){E(this.b,this.a,"seeking",this.$b.bind(this));E(this.b,this.a,"playing",this.Yb.bind(this))}; +k.Zb=function(){if(this.a.readyState){this.a.readyState!=this.B&&(this.i=!1,this.B=this.a.readyState);var a=this.l.smallGapLimit,b=this.a.currentTime,c=this.a.buffered,d;a:{if(c&&c.length&&!(1==c.length&&1E-6>c.end(0)-c.start(0))){d=.1;/(Edge|Trident)\//.test(navigator.userAgent)&&(d=.5);for(var e=0;eb&&(!e||c.end(e-1)-b<=d)){d=e;break a}}d=null}if(null==d){if(3>this.a.readyState&&0=c.start(d)&&b=this.c.presentationTimeline.Xa())){var f=e-b,a=f<=a,g=!1;a||this.i||(this.i=!0,f=new H("largegap",{currentTime:b,gapSize:f}),f.cancelable=!0,this.F(f),this.l.jumpLargeGaps&&!f.defaultPrevented&&(g=!0));if(a||g)d&&c.end(d-1),qf(this,b,e)}}};k.$b=function(){this.o=!1;var a=this.a.currentTime,b=rf(this,a);.001f?f:b=g||c(b)?b:d}function qf(a,b,c){a.a.currentTime=c;var d=0,e=function(){!this.a||10<=d++||this.a.currentTime!=b||(this.a.currentTime=c,setTimeout(e,100))}.bind(a);setTimeout(e,100)} +function mf(a,b){var c=a.c.presentationTimeline.ja();if(bc?c:b};function sf(a,b,c,d,e,f){this.a=a;this.g=b;this.A=c;this.l=d;this.h=e;this.B=f;this.c=[];this.j=new D;this.b=!1;this.i=-1;this.f=null;tf(this)}sf.prototype.m=function(){var a=this.j?this.j.m():Promise.resolve();this.j=null;uf(this);this.B=this.h=this.l=this.A=this.g=this.a=null;this.c=[];return a}; +sf.prototype.v=function(a){if(!this.c.some(function(b){return b.info.schemeIdUri==a.schemeIdUri&&b.info.startTime==a.startTime&&b.info.endTime==a.endTime})){var b={info:a,status:1};this.c.push(b);var c=new H("timelineregionadded",{detail:vf(a)});this.h(c);this.o(!0,b)}};function vf(a){var b=Da(a);b.eventElement=a.eventElement;return b} +sf.prototype.o=function(a,b){var c=b.info.startTime>this.a.currentTime?1:b.info.endTime=this.g.presentationTimeline.ra()-.1||this.a.ended;if(this.b){var c=1*Math.max(this.g.minBufferTime||0,this.A.rebufferingGoal);(b||a>=c)&&0!=this.b&&(this.b=!1,this.l(!1))}else!b&&.5>a&&1!=this.b&&(this.b=!0,this.l(!0));this.c.forEach(this.o.bind(this,!1))};function wf(a,b){this.a=b;this.b=a;this.h=null;this.i=1;this.o=Promise.resolve();this.g=[];this.j={};this.c={};this.f=this.l=this.v=!1}k=wf.prototype;k.m=function(){for(var a in this.c)xf(this.c[a]);this.h=this.c=this.j=this.g=this.o=this.b=this.a=null;this.f=!0;return Promise.resolve()};k.configure=function(a){this.h=a};k.init=function(){var a=this.a.Tb(this.b.periods[fc(this.b,nf(this.a.Ka))]);return La(a)?Promise.reject(new t(2,5,5005)):yf(this,a).then(function(){this.a&&this.a.Xc&&this.a.Xc()}.bind(this))}; +function V(a){return a.b.periods[fc(a.b,nf(a.a.Ka))]}function zf(a){return Na(a.c,function(a){return a.ka||a.stream})}function Af(a,b){var c={};c.text=b;return yf(a,c)}function Bf(a,b){var c=a.c.video;if(c){var d=c.stream;if(d)if(b){var e=d.trickModeVideo;if(e){var f=c.ka;f||(Cf(a,"video",e,!1),c.ka=d)}}else if(f=c.ka)c.ka=null,Cf(a,"video",f,!0)}} +function Cf(a,b,c,d){var e=a.c[b];!e&&"text"==b&&a.h.ignoreTextStreamFailures?Af(a,c):e&&(e.ka&&(c.trickModeVideo?(e.ka=c,c=c.trickModeVideo):e.ka=null),"text"==b&&Db(a.a.G,Wb(c.mimeType,c.codecs)),(b=a.g[gc(a.b,c)])&&b.Ga&&(b=a.j[c.id])&&b.Ga&&e.stream!=c&&(e.stream=c,e.Ya=!0,d&&(e.pa?e.fb=!0:e.ta?(e.oa=!0,e.fb=!0):(xf(e),Df(a,e,!0)))))} +function Ef(a){var b=nf(a.a.Ka);if(!Object.keys(a.c).every(function(a){var c=this.a.G;"text"==a?(a=c.a,a=b>=a.b&&bb?a.a.G.ma(b):a.a.G.ma(Math.pow(2,32))}k.Zd=function(a){if(!this.f&&!a.ta&&null!=a.na&&!a.pa)if(a.na=null,a.oa)Df(this,a,a.fb);else{try{var b=Jf(this,a);null!=b&&(Ff(this,a,b),a.mb=!1)}catch(c){this.a.onError(c);return}b=Ma(this.c);Kf(this,a);b.every(function(a){return a.endOfStream})&&this.a.G.endOfStream().then(function(){this.b.presentationTimeline.ma(this.a.G.W())}.bind(this))}}; +function Jf(a,b){var c=nf(a.a.Ka),d=b.Ba&&b.ba?a.b.periods[gc(a.b,b.Ba)].startTime+b.ba.endTime:Math.max(c,b.gc);b.gc=0;var e=gc(a.b,b.stream),f=fc(a.b,d),g;g=a.a.G;var h=b.type;"text"==h?(g=g.a,g=null==g.a||g.a=a.b.presentationTimeline.W())return b.endOfStream=!0,null;b.endOfStream=!1;b.Ia=f;if(f!=e)return null;if(g>=h)return.5;d=a.a.G;f=b.type;d="text"==f? +d.a.a:yb(Fb(d,f));b.ba&&b.stream==b.Ba?(f=b.ba.position+1,d=Lf(a,b,e,f)):(f=b.ba?b.stream.findSegmentPosition(Math.max(0,a.b.periods[gc(a.b,b.Ba)].startTime+b.ba.endTime-a.b.periods[e].startTime)):b.stream.findSegmentPosition(Math.max(0,(d||c)-a.b.periods[e].startTime)),null==f?d=null:(g=null,null==d&&(g=Lf(a,b,e,Math.max(0,f-1))),d=g||Lf(a,b,e,f)));if(!d)return 1;Mf(a,b,c,e,d);return null} +function Lf(a,b,c,d){c=a.b.periods[c];b=b.stream.getSegmentReference(d);if(!b)return null;a=a.b.presentationTimeline;d=a.ra();return c.startTime+b.endTimed?null:b} +function Mf(a,b,c,d,e){var f=a.b.periods[d],g=b.stream,h=a.b.periods[d+1],l=null,l=h?h.startTime:a.b.presentationTimeline.W();d=Nf(a,b,d,l);b.ta=!0;b.Ya=!1;h=Of(a,e);Promise.all([d,h]).then(function(a){if(!this.f&&!this.l)return Pf(this,b,c,f,g,e,a[1])}.bind(a)).then(function(){this.f||this.l||(b.ta=!1,b.xb=!1,b.oa||this.a.tb(),Ff(this,b,0),Qf(this,g))}.bind(a))["catch"](function(a){this.f||this.l||(b.ta=!1,1001==a.code||1002==a.code||1003==a.code?"text"==b.type&&this.h.ignoreTextStreamFailures&& +1001==a.code?delete this.c.text:(a.severity=1,this.a.onError(a),Ff(this,b,4)):3017==a.code?Rf(this,b,a):"text"==b.type&&this.h.ignoreTextStreamFailures?delete this.c.text:(b.mb=!0,a.severity=2,this.a.onError(a)))}.bind(a))}function Rf(a,b,c){if(!Ma(a.c).some(function(a){return a!=b&&a.xb})){var d=Math.round(100*a.i);if(20=c?Promise.resolve():a.a.G.remove(b.type,d,d+c).then(function(){}.bind(a))}function Qf(a,b){if(!a.v&&(a.v=Ma(a.c).every(function(a){return"text"==a.type?!0:!a.oa&&!a.pa&&a.ba}),a.v)){var c=gc(a.b,b);a.g[c]||If(a,c).then(function(){this.a.Sb()}.bind(a))["catch"](y);for(c=0;c=b.status&&202!=b.status)b.responseURL&&(a=b.responseURL),c({uri:a,data:b.response,headers:e,fromCache:!!e["x-shaka-from-cache"]}); +else{var f=null;try{f=Ra(b.response)}catch(n){}d(new t(401==b.status||403==b.status?2:1,1,1001,a,b.status,f,e))}};e.onerror=function(){d(new t(1,1,1002,a))};e.ontimeout=function(){d(new t(1,1,1003,a))};for(var f in b.headers)e.setRequestHeader(f,b.headers[f]);e.send(b.body)})}m("shaka.net.HttpPlugin",Uf);Ea.http=Uf;Ea.https=Uf;function Vf(){this.a=null;this.c=[];this.b={}}k=Vf.prototype;k.init=function(a,b){return Wf(this,a,b).then(function(){var b=Object.keys(a);return Promise.all(b.map(function(a){return Xf(this,a).then(function(b){this.b[a]=b}.bind(this))}.bind(this)))}.bind(this))};k.m=function(){return Promise.all(this.c.map(function(a){try{a.transaction.abort()}catch(b){}return a.O["catch"](y)})).then(function(){this.a&&(this.a.close(),this.a=null)}.bind(this))};k.get=function(a,b){return Yf(this,a,"readonly",function(a){return a.get(b)})}; +k.forEach=function(a,b){return Yf(this,a,"readonly",function(a){return a.openCursor()},function(a){a&&(b(a.value),a["continue"]())})};function Zf(a,b,c){return Yf(a,b,"readwrite",function(a){return a.put(c)})}k.remove=function(a,b){return Yf(this,a,"readwrite",function(a){return a["delete"](b)})}; +function $f(a,b){var c=[];return Yf(a,"segment","readwrite",function(a){return a.openCursor()},function(a){if(a){if(b(a.value)){var d=a["delete"](),f=new A;d.onsuccess=f.resolve;d.onerror=ag.bind(null,d,f);c.push(f)}a["continue"]()}}).then(function(){return Promise.all(c)}).then(function(){return c.length})}function Xf(a,b){var c=0;return Yf(a,b,"readonly",function(a){return a.openCursor(null,"prev")},function(a){a&&(c=a.key+1)}).then(function(){return c})} +function Yf(a,b,c,d,e){c=a.a.transaction([b],c);var f=d(c.objectStore(b)),g=new A;e&&(f.onsuccess=function(a){e(a.target.result)});f.onerror=function(){};var h={transaction:c,O:g};a.c.push(h);var l=function(){this.c.splice(this.c.indexOf(h),1)}.bind(a);c.oncomplete=function(){l();g.resolve(f.result)};c.onerror=function(a){a.preventDefault()};c.onabort=function(a){l();ag(f,g,a)};return g} +function Wf(a,b,c){var d=window.indexedDB.open("shaka_offline_db",1),e=!1,f=new A;d.onupgradeneeded=function(a){e=!0;a=a.target.result;for(var c in b)a.createObjectStore(c,{keyPath:b[c]})};d.onsuccess=function(a){c&&!e?(a.target.result.close(),setTimeout(function(){Wf(this,b,c-1).then(f.resolve,f.reject)}.bind(this),1E3)):(this.a=a.target.result,f.resolve())}.bind(a);d.onerror=ag.bind(null,d,f);return f} +function ag(a,b,c){a.error&&"AbortError"!=a.error.name?b.reject(new t(2,9,9001,a.error)):b.reject(new t(2,9,9002));c.preventDefault()};var bg={manifest:"key",segment:"key"};function cg(a){var b=dg(a.periods[0],[],new T(null,0)),c=Xb(b,null,null),b=Zb(b,null);c.push.apply(c,b);return{offlineUri:"offline:"+a.key,originalManifestUri:a.originalManifestUri,duration:a.duration,size:a.size,expiration:void 0==a.expiration?Infinity:a.expiration,tracks:c,appMetadata:a.appMetadata}} +function dg(a,b,c){var d=a.streams.filter(function(a){return"text"==a.contentType}),e=a.streams.filter(function(a){return"audio"==a.contentType}),f=a.streams.filter(function(a){return"video"==a.contentType});b=eg(e,f,b);d=d.map(fg);a.streams.forEach(function(a){a=gg(a);c.Da(0,a)});return{startTime:a.startTime,variants:b,textStreams:d}}function gg(a){return a.segments.map(function(a,c){return new N(c,a.startTime,a.endTime,function(){return[a.uri]},0,null)})} +function eg(a,b,c){var d=[];if(!a.length&&!b.length)return d;a.length?b.length||(b=[null]):a=[null];for(var e=0,f=0;f=a.length)return Promise.resolve();var d=a[b++];return mg(this,d).then(c)}.bind(this);return c()}.bind(a));a.b={};a.i=Promise.all(c).then(function(){return Zf(this.j,"manifest",b)}.bind(a)).then(function(){this.l=[]}.bind(a)); +return a.i} +function mg(a,b){var c=C(b.uris,a.A);if(b.V||null!=b.J)c.headers.Range="bytes="+b.V+"-"+(null==b.J?"":b.J);var d;return a.v.request(1,c).then(function(a){if(!this.a)return Promise.reject(new t(2,9,9002));d=a.data.byteLength;this.l.push(b.yb.key);b.yb.data=a.data;return Zf(this.j,"segment",b.yb)}.bind(a)).then(function(){if(!this.a)return Promise.reject(new t(2,9,9002));null==b.J?(this.a.size+=d,this.f+=b.Ib):this.h+=d;var a=(this.h+this.f)/(this.c+this.g),c=cg(this.a);this.o.progressCallback(c,a)}.bind(a))} +;function ng(){this.a=-1}k=ng.prototype;k.configure=function(){};k.start=function(a){var b=/^offline:([0-9]+)$/.exec(a);if(!b)return Promise.reject(new t(2,1,9004,a));var c=Number(b[1]),d=ig();this.a=c;return d?d.init(bg).then(function(){return d.get("manifest",c)}).then(function(a){if(!a)throw new t(2,9,9003,c);return og(a)}).then(function(a){return d.m().then(function(){return a})},function(a){return d.m().then(function(){throw a;})}):Promise.reject(new t(2,9,9E3))};k.stop=function(){return Promise.resolve()}; +k.update=function(){};k.onExpirationUpdated=function(a,b){var c=ig();c.init(bg).then(function(){return c.get("manifest",this.a)}.bind(this)).then(function(d){if(d&&!(0>d.sessionIds.indexOf(a))&&(void 0==d.expiration||d.expiration>b))return d.expiration=b,Zf(c,"manifest",d)})["catch"](function(){}).then(function(){return c.m()})}; +function og(a){var b=new T(null,0);b.ma(a.duration);var c=a.drmInfo?[a.drmInfo]:[];return{presentationTimeline:b,minBufferTime:10,offlineSessionIds:a.sessionIds,periods:a.periods.map(function(a){return dg(a,c,b)})}}Id["application/x-offline-manifest"]=ng;function pg(a){if(/^offline:([0-9]+)$/.exec(a)){var b={uri:a,data:new ArrayBuffer(0),headers:{"content-type":"application/x-offline-manifest"}};return Promise.resolve(b)}if(b=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(a)){var c=Number(b[1]),d=ig();return d?d.init(bg).then(function(){return d.get("segment",c)}).then(function(b){return d.m().then(function(){if(!b)throw new t(2,9,9003,c);return{uri:a,data:b.data,headers:{}}})}):Promise.reject(new t(2,9,9E3))}return Promise.reject(new t(2,1,9004,a))} +m("shaka.offline.OfflineScheme",pg);Ea.offline=pg;function qg(){this.a=Promise.resolve();this.c=this.b=this.f=!1;this.g=new Promise(function(a){this.h=a}.bind(this))}qg.prototype.then=function(a){this.a=this.a.then(a).then(function(a){return this.c?(this.h(),Promise.reject(this.i)):Promise.resolve(a)}.bind(this));return this};function rg(a){a.f||(a.a=a.a.then(function(a){this.b=!0;return Promise.resolve(a)}.bind(a),function(a){this.b=!0;return Promise.reject(a)}.bind(a)));a.f=!0;return a.a} +qg.prototype.cancel=function(a){if(this.b)return Promise.resolve();this.c=!0;this.i=a;return this.g};function W(a,b){p.call(this);this.I=!1;this.f=a;this.A=null;this.l=new D;this.Hb=new G;this.Ta=this.c=this.h=this.a=this.v=this.g=this.Ra=this.ga=this.K=this.j=this.o=null;this.sc=1E9;this.Qa=[];this.ha=!1;this.Ua=!0;this.ia=this.F=null;this.B={};this.Sa=[];this.M={};this.b=sg(this);this.hb={width:Infinity,height:Infinity};this.i=tg();this.Pa=0;this.fa=this.b.preferredAudioLanguage;this.ya=this.b.preferredTextLanguage;b&&b(this);this.o=new B(this.Sd.bind(this));this.Ra=ug(this);for(var c=0;cthis.Qa.indexOf(a.id)}.bind(this))};W.prototype.getTextTracks=W.prototype.Ob; +W.prototype.ic=function(a){if(this.a&&(a=ac(V(this.a),a))){Eg(this,a,!1);var b={};b.text=a;Fg(this,b,!0)}};W.prototype.selectTextTrack=W.prototype.ic; +W.prototype.jc=function(a,b){if(this.a){var c={},d=$b(V(this.a),a),e=zf(this.a);if(d){if(!d.allowedByApplication||!d.allowedByKeySystem)return;d.audio&&(Gg(this,d.audio),d.audio!=e.audio&&(c.audio=d.audio));d.video&&(Gg(this,d.video),d.video!=e.video&&(c.video=d.video))}Ma(c).forEach(function(a){Eg(this,a,!1)}.bind(this));(d=e.text)&&(c.text=d);Fg(this,c,b)}};W.prototype.selectVariantTrack=W.prototype.jc; +W.prototype.Ec=function(){return this.a?Yb(V(this.a).variants).map(function(a){return a.language}).filter(Aa):[]};W.prototype.getAudioLanguages=W.prototype.Ec;W.prototype.Lc=function(){return this.a?V(this.a).textStreams.map(function(a){return a.language}).filter(Aa):[]};W.prototype.getTextLanguages=W.prototype.Lc;W.prototype.Id=function(a){if(this.a){var b=V(this.a);this.fa=a;Cg(this,b)}};W.prototype.selectAudioLanguage=W.prototype.Id; +W.prototype.Jd=function(a){if(this.a){var b=V(this.a);this.ya=a;Cg(this,b)}};W.prototype.selectTextLanguage=W.prototype.Jd;W.prototype.Qc=function(){return"showing"==this.A.mode};W.prototype.isTextTrackVisible=W.prototype.Qc;W.prototype.Md=function(a){this.A.mode=a?"showing":"hidden";Hg(this)};W.prototype.setTextTrackVisibility=W.prototype.Md;W.prototype.Ic=function(){return this.c?new Date(1E3*this.c.presentationTimeline.f+1E3*this.f.currentTime):null};W.prototype.getPlayheadTimeAsDate=W.prototype.Ic; +W.prototype.getStats=function(){Ig(this);this.Na();var a=null,b=null,c=this.f&&this.f.getVideoPlaybackQuality?this.f.getVideoPlaybackQuality():{};this.g&&this.c&&(a=fc(this.c,nf(this.g)),b=this.M[a],b=ec(b.audio,b.video,this.c.periods[a].variants),a=b.video||{});a||(a={});b||(b={});return{width:a.width||0,height:a.height||0,streamBandwidth:b.bandwidth||0,decodedFrames:Number(c.totalVideoFrames),droppedFrames:Number(c.droppedVideoFrames),estimatedBandwidth:this.b.abr.manager.getBandwidthEstimate(), +loadLatency:this.i.loadLatency,playTime:this.i.playTime,bufferingTime:this.i.bufferingTime,switchHistory:Da(this.i.switchHistory),stateHistory:Da(this.i.stateHistory)}};W.prototype.getStats=W.prototype.getStats; +W.prototype.addTextTrack=function(a,b,c,d,e){if(!this.a)return Promise.reject();for(var f=V(this.a),g,h=0;hYb(a.variants).length;if(!b)throw new t(2,4,4011);if(a)throw new t(2,4,4012);}; +function Fg(a,b,c){for(var d in b){var e=b[d],f=c||!1;"text"==d&&(f=!0);a.Ua?a.B[d]={stream:e,zc:f}:Cf(a.a,d,e,f)}}function Ig(a){if(a.c){var b=Date.now()/1E3;a.ha?a.i.bufferingTime+=b-a.Pa:a.i.playTime+=b-a.Pa;a.Pa=b}} +function xg(a,b){function c(a,b){if(!a)return null;var c=a.findSegmentPosition(b-e.startTime);return null==c?null:(c=a.getSegmentReference(c))?c.startTime+e.startTime:null}var d=zf(a.a),e=V(a.a),f=c(d.video,b),d=c(d.audio,b);return null!=f&&null!=d?Math.max(f,d):null!=f?f:null!=d?d:b}k.Sd=function(a,b){this.b.abr.manager.segmentDownloaded(a,b)};k.oc=function(a){Ig(this);this.ha=a;this.Na();if(this.g){var b=this.g;a!=b.h&&(b.h=a,pf(b,b.g))}this.dispatchEvent(new H("buffering",{buffering:a}))}; +k.Od=function(){yg(this)};k.Na=function(){if(!this.I){var a;a=this.ha?"buffering":this.f.ended?"ended":this.f.paused?"paused":"playing";var b=Date.now()/1E3;if(this.i.stateHistory.length){var c=this.i.stateHistory[this.i.stateHistory.length-1];c.duration=b-c.timestamp;if(a==c.state)return}this.i.stateHistory.push({timestamp:b,state:a,duration:0})}};k.Rd=function(){if(this.v){var a=this.v;a.c.forEach(a.o.bind(a,!0))}this.a&&Ef(this.a)}; +function Jg(a,b,c,d,e){if(!c||1>c.length)return a.ua(new t(2,4,4012)),{};a.b.abr.manager.setVariants(c);a.b.abr.manager.setTextStreams(d);var f=[];e&&(f=["video","audio"],b.textStreams.length&&f.push("text"));e=zf(a.a);if(b=dc(e.audio,e.video,b.variants)){b.allowedByApplication&&b.allowedByKeySystem||(f.push("audio"),f.push("video"));for(var g in e)b=e[g],"audio"==b.type&&b.language!=c[0].language?f.push(g):"text"==b.type&&0b&&(b+=Math.pow(2,32)),b=b.toString(16));this.ua(new t(2,3,3016,a,b))}}}; +k.Qd=function(a){var b=["output-restricted","internal-error"],c=V(this.a),d=!1;c.variants.forEach(function(c){var e=[];c.audio&&e.push(c.audio);c.video&&e.push(c.video);e.forEach(function(e){var f=c.allowedByKeySystem;e.keyId&&(e=a[e.keyId],c.allowedByKeySystem=!!e&&0>b.indexOf(e));f!=c.allowedByKeySystem&&(d=!0)})});var e=zf(this.a);(e=dc(e.audio,e.video,c.variants))&&!e.allowedByKeySystem&&Cg(this,c);d&&yg(this)}; +k.Pd=function(a,b){if(this.h&&this.h.onExpirationUpdated)this.h.onExpirationUpdated(a,b);this.dispatchEvent(new H("expirationupdated"))};function X(a){this.a=ig();this.f=a;this.i=Kg(this);this.b=null;this.v=!1;this.j=null;this.g=-1;this.l=0;this.c=null;this.h=new jg(this.a,a.o,a.getConfiguration().streaming.retryParameters,this.i)}m("shaka.offline.Storage",X);function Lg(){return!!window.indexedDB}X.support=Lg;X.prototype.m=function(){var a=this.a,b=this.h?this.h.m()["catch"](function(){}).then(function(){if(a)return a.m()}):Promise.resolve();this.i=this.f=this.h=this.a=null;return b};X.prototype.destroy=X.prototype.m; +X.prototype.configure=function(a){Ca(this.i,a,Kg(this),{},"")};X.prototype.configure=X.prototype.configure; +X.prototype.$d=function(a,b,c){function d(a){f=a}if(this.v)return Promise.reject(new t(2,9,9006));this.v=!0;var e,f=null;return Mg(this).then(function(){Y(this);return Ng(this,a,d,c)}.bind(this)).then(function(c){Y(this);this.c=c.manifest;this.b=c.Ac;if(this.c.presentationTimeline.aa()||this.c.presentationTimeline.sa())throw new t(2,9,9005,a);this.c.periods.forEach(this.o.bind(this));this.g=this.a.b.manifest++;this.l=0;c=this.c.periods.map(this.B.bind(this));var d=this.b.b,f=hb(this.b);if(d){if(!f.length)throw new t(2, +9,9007,a);d.initData=[]}e={key:this.g,originalManifestUri:a,duration:this.l,size:0,expiration:this.b.Wa(),periods:c,sessionIds:f,drmInfo:d,appMetadata:b};return lg(this.h,e)}.bind(this)).then(function(){Y(this);if(f)throw f;return Og(this)}.bind(this)).then(function(){return cg(e)}.bind(this))["catch"](function(a){return Og(this)["catch"](y).then(function(){throw a;})}.bind(this))};X.prototype.store=X.prototype.$d; +X.prototype.remove=function(a){function b(a){6013!=a.code&&(e=a)}var c=a.offlineUri,d=/^offline:([0-9]+)$/.exec(c);if(!d)return Promise.reject(new t(2,9,9004,c));var e=null,f,g,h=Number(d[1]);return Mg(this).then(function(){Y(this);return this.a.get("manifest",h)}.bind(this)).then(function(a){Y(this);if(!a)throw new t(2,9,9003,c);f=a;a=og(f);g=new $a(this.f.o,b,function(){},function(){});g.configure(this.f.getConfiguration().drm);return g.init(a,!0)}.bind(this)).then(function(){return eb(g,f.sessionIds)}.bind(this)).then(function(){return g.m()}.bind(this)).then(function(){Y(this); +if(e)throw e;var b=f.periods.map(function(a){return a.streams.map(function(a){var b=a.segments.map(function(a){a=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(a.uri);return Number(a[1])});a.initSegmentUri&&(a=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(a.initSegmentUri),b.push(Number(a[1])));return b}).reduce(x,[])}).reduce(x,[]),c=0,d=b.length,g=this.i.progressCallback;return $f(this.a,function(e){e=b.indexOf(e.key);0<=e&&(g(a,c/d),c++);return 0<=e}.bind(this))}.bind(this)).then(function(){Y(this);this.i.progressCallback(a, +1);return this.a.remove("manifest",h)}.bind(this))};X.prototype.remove=X.prototype.remove;X.prototype.list=function(){var a=[];return Mg(this).then(function(){Y(this);return this.a.forEach("manifest",function(b){a.push(cg(b))})}.bind(this)).then(function(){return a})};X.prototype.list=X.prototype.list; +function Ng(a,b,c,d){function e(){}var f=a.f.o,g=a.f.getConfiguration(),h,l,n;return Ld(b,f,g.manifest.retryParameters,d).then(function(a){Y(this);n=new a;n.configure(g.manifest);return n.start(b,{networkingEngine:f,filterPeriod:this.o.bind(this),onTimelineRegionAdded:function(){},onEvent:function(){},onError:c})}.bind(a)).then(function(a){Y(this);h=a;l=new $a(f,c,e,function(){});l.configure(g.drm);return l.init(h,!0)}.bind(a)).then(function(){Y(this);return Pg(h)}.bind(a)).then(function(){Y(this); +return db(l)}.bind(a)).then(function(){Y(this);return n.stop()}.bind(a)).then(function(){Y(this);return{manifest:h,Ac:l}}.bind(a))["catch"](function(a){if(n)return n.stop().then(function(){throw a;});throw a;})} +X.prototype.A=function(a){for(var b=[],c=Qb(this.f.getConfiguration().preferredAudioLanguage),d=[0,Ob,Pb],e=a.filter(function(a){return"variant"==a.type}),d=d.map(function(a){return e.filter(function(b){b=Qb(b.language);return Nb(a,c,b)})}),f,g=0;g=a.height});h.length&&(h.sort(function(a, +b){return b.height-a.height}),f=h.filter(function(a){return a.height==h[0].height}));f.sort(function(a,b){return a.bandwidth-b.bandwidth});f.length&&b.push(f[Math.floor(f.length/2)]);b.push.apply(b,a.filter(function(a){return"text"==a.type}));return b};function Kg(a){return{trackSelectionCallback:a.A.bind(a),progressCallback:function(a,c){if(a||c)return null}}}function Mg(a){return a.a?a.a.a?Promise.resolve():a.a.init(bg):Promise.reject(new t(2,9,9E3))} +X.prototype.o=function(a){var b={};if(this.j){var c=this.j.filter(function(a){return"variant"==a.type}),d=null;c.length&&(d=$b(a,c[0]));d&&(d.video&&(b.video=d.video),d.audio&&(b.audio=d.audio))}Ub(this.b,b,a);Tb(a,this.f.getConfiguration().restrictions,{width:Infinity,height:Infinity})};function Og(a){var b=a.b?a.b.m():Promise.resolve();a.b=null;a.c=null;a.v=!1;a.j=null;a.g=-1;return b} +function Pg(a){var b=a.periods.map(function(a){return a.variants}).reduce(x,[]).map(function(a){var b=[];a.audio&&b.push(a.audio);a.video&&b.push(a.video);return b}).reduce(x,[]).filter(Aa);a=a.periods.map(function(a){return a.textStreams}).reduce(x,[]);b.push.apply(b,a);return Promise.all(b.map(function(a){return a.createSegmentIndex()}))} +X.prototype.B=function(a){var b=Xb(a,null,null),c=Zb(a,null),b=this.i.trackSelectionCallback(b.concat(c));this.j||(this.j=b,this.c.periods.forEach(this.o.bind(this)));for(c=b.length-1;0=c.a.length)){for(var d=[],e=0;ea.indexOf("Apple")||(0<=b.indexOf("Version/8")?window.MediaSource=null:0<=b.indexOf("Version/9")?xh():0<=b.indexOf("Version/10")&&(xh(),yh()))}});function Z(a){this.c=[];this.b=[];this.wa=Bh;if(a)try{a(this.ca.bind(this),this.a.bind(this))}catch(b){this.a(b)}}var Bh=0;function Ch(a){var b=new Z;b.ca(void 0);return b.then(function(){return a})}function Dh(a){var b=new Z;b.a(a);return b}function Eh(a){function b(a,b,c){a.wa==Bh&&(e[b]=c,d++,d==e.length&&a.ca(e))}var c=new Z;if(!a.length)return c.ca([]),c;for(var d=0,e=Array(a.length),f=c.a.bind(c),g=0;g