shaka-player 4.2.10 → 4.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/demo-version-index.yaml +3 -3
- package/CHANGELOG.md +17 -0
- package/README.md +3 -0
- package/demo/demo.less +1 -0
- package/dist/demo.css +1 -1
- package/dist/demo.css.map +1 -1
- package/dist/locales.js +30 -30
- package/dist/shaka-player.compiled.d.ts +8 -0
- package/dist/shaka-player.compiled.debug.d.ts +8 -0
- package/dist/shaka-player.compiled.debug.externs.js +9 -0
- package/dist/shaka-player.compiled.debug.js +40 -38
- package/dist/shaka-player.compiled.debug.map +3 -3
- package/dist/shaka-player.compiled.externs.js +9 -0
- package/dist/shaka-player.compiled.js +425 -424
- package/dist/shaka-player.compiled.map +3 -3
- package/dist/shaka-player.ui.d.ts +8 -0
- package/dist/shaka-player.ui.debug.d.ts +8 -0
- package/dist/shaka-player.ui.debug.externs.js +9 -0
- package/dist/shaka-player.ui.debug.js +166 -164
- package/dist/shaka-player.ui.debug.map +3 -3
- package/dist/shaka-player.ui.externs.js +9 -0
- package/dist/shaka-player.ui.js +234 -233
- package/dist/shaka-player.ui.map +3 -3
- package/docs/tutorials/welcome.md +1 -1
- package/lib/hls/hls_parser.js +6 -0
- package/lib/hls/manifest_text_parser.js +10 -1
- package/lib/media/drm_engine.js +9 -6
- package/lib/media/media_source_engine.js +6 -4
- package/lib/media/segment_reference.js +22 -0
- package/lib/media/streaming_engine.js +9 -4
- package/lib/player.js +5 -1
- package/package.json +9 -3
- package/test/hls/hls_live_unit.js +3 -1
- package/test/media/media_source_engine_unit.js +31 -0
- package/test/test/util/layout_tests.js +4 -3
|
@@ -433,8 +433,8 @@ shaka.util.XmlUtils.parseFloat=function(a){a=Number(a);return isNaN(a)?null:a};s
|
|
|
433
433
|
shaka.util.XmlUtils.parseXmlString=function(a,b){var c=new DOMParser,d=shaka.util.XmlUtils.trustedHTMLFromString_.value()(a);a=null;try{a=c.parseFromString(d,"text/xml")}catch(e){return shaka.log.error("XML parsing exception:",e),null}goog.asserts.assert(a,"Parsed XML document cannot be null!");c=a.documentElement;if(!c)return shaka.log.error("XML document was empty!"),null;d=c.getElementsByTagName("parsererror");if(d.length)return shaka.log.error("XML parser error found:",d[0]),null;if(c.tagName!=
|
|
434
434
|
b)return shaka.log.error('XML tag name does not match expected "'+b+'":',c.tagName),null;for(b=document.createNodeIterator(a,NodeFilter.SHOW_ALL);a=b.nextNode();)if(a instanceof HTMLElement||a instanceof SVGElement)return shaka.log.error("XML document embeds unsafe content!"),null;return c};shaka.util.XmlUtils.parseXml=function(a,b){try{var c=shaka.util.StringUtils.fromUTF8(a);return shaka.util.XmlUtils.parseXmlString(c,b)}catch(d){return shaka.log.error("parseXmlString threw!",d),null}};
|
|
435
435
|
shaka.util.XmlUtils.trustedHTMLFromString_=new shaka.util.Lazy(function(){if("undefined"!==typeof trustedTypes){var a=trustedTypes.createPolicy("shaka-player#xml",{createHTML:function(b){return b}});return function(b){return a.createHTML(b)}}return function(b){return b}});shaka.media.DrmEngine=function(a,b){var c=this;b=void 0===b?1:b;this.playerInterface_=a;this.supportedTypes_=new Set;this.video_=this.mediaKeys_=null;this.initializedForStorage_=this.initialized_=!1;this.licenseTimeSeconds_=0;this.currentDrmInfo_=null;this.eventManager_=new shaka.util.EventManager;this.activeSessions_=new Map;this.offlineSessionIds_=[];this.allSessionsLoaded_=new shaka.util.PublicPromise;this.config_=null;this.onError_=function(d){c.allSessionsLoaded_.reject(d);a.onError(d)};this.keyStatusByKeyId_=
|
|
436
|
-
new Map;this.announcedKeyStatusByKeyId_=new Map;this.keyStatusTimer_=new shaka.util.Timer(function(){return c.processKeyStatusChanges_()});this.usePersistentLicenses_=!1;this.mediaKeyMessageEvents_=[];this.initialRequestsSent_=!1;this.expirationTimer_=(new shaka.util.Timer(function(){c.pollExpiration_()})).tickEvery(b);this.allSessionsLoaded_.catch(function(){});this.destroyer_=new shaka.util.Destroyer(function(){return c.destroyNow_()});this.srcEquals_=!1;this.mediaKeysAttached_=
|
|
437
|
-
shaka.media.DrmEngine.prototype.destroy=function(){return this.destroyer_.destroy()};
|
|
436
|
+
new Map;this.announcedKeyStatusByKeyId_=new Map;this.keyStatusTimer_=new shaka.util.Timer(function(){return c.processKeyStatusChanges_()});this.usePersistentLicenses_=!1;this.mediaKeyMessageEvents_=[];this.initialRequestsSent_=!1;this.expirationTimer_=(new shaka.util.Timer(function(){c.pollExpiration_()})).tickEvery(b);this.allSessionsLoaded_.catch(function(){});this.destroyer_=new shaka.util.Destroyer(function(){return c.destroyNow_()});this.srcEquals_=!1;this.manifestInitData_=this.mediaKeysAttached_=
|
|
437
|
+
null};shaka.media.DrmEngine.prototype.destroy=function(){return this.destroyer_.destroy()};
|
|
438
438
|
shaka.media.DrmEngine.prototype.destroyNow_=function(){var a=this;return $jscomp.asyncExecutePromiseGeneratorProgram(function(b){switch(b.nextAddress){case 1:return a.eventManager_.release(),a.eventManager_=null,a.allSessionsLoaded_.reject(),a.expirationTimer_.stop(),a.expirationTimer_=null,a.keyStatusTimer_.stop(),a.keyStatusTimer_=null,b.yield(a.closeOpenSessions_(),2);case 2:if(!a.video_){b.jumpTo(3);break}goog.asserts.assert(!a.video_.src,"video src must be removed first!");b.setCatchFinallyBlocks(4);
|
|
439
439
|
return b.yield(a.video_.setMediaKeys(null),6);case 6:b.leaveTryBlock(5);break;case 4:b.enterCatchBlock();case 5:a.video_=null;case 3:a.currentDrmInfo_=null,a.supportedTypes_.clear(),a.mediaKeys_=null,a.offlineSessionIds_=[],a.config_=null,a.onError_=function(){},a.playerInterface_=null,a.srcEquals_=!1,a.mediaKeysAttached_=null,b.jumpToEnd()}})};shaka.media.DrmEngine.prototype.configure=function(a){this.config_=a};shaka.media.DrmEngine.prototype.setSrcEquals=function(a){this.srcEquals_=a};
|
|
440
440
|
shaka.media.DrmEngine.prototype.initForStorage=function(a,b){this.initializedForStorage_=!0;this.offlineSessionIds_=[];this.usePersistentLicenses_=b;return this.init_(a)};shaka.media.DrmEngine.prototype.initForPlayback=function(a,b){this.offlineSessionIds_=b;this.usePersistentLicenses_=0<b.length;return this.init_(a)};
|
|
@@ -445,13 +445,13 @@ b.usePersistentLicenses_,b.srcEquals_),2)}r=g||Object.keys(b.config_.servers).le
|
|
|
445
445
|
shaka.media.DrmEngine.prototype.attachMediaKeys_=function(){var a=this,b;return $jscomp.asyncExecutePromiseGeneratorProgram(function(c){switch(c.nextAddress){case 1:if(a.video_.mediaKeys)return c.return();if(!a.mediaKeysAttached_){c.jumpTo(2);break}return c.yield(a.mediaKeysAttached_,3);case 3:return a.destroyer_.ensureNotDestroyed(),c.return();case 2:return c.setCatchFinallyBlocks(4),a.mediaKeysAttached_=a.video_.setMediaKeys(a.mediaKeys_),c.yield(a.mediaKeysAttached_,6);case 6:c.leaveTryBlock(5);
|
|
446
446
|
break;case 4:b=c.enterCatchBlock(),goog.asserts.assert(b instanceof Error,"Wrong error type!"),a.onError_(new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.DRM,shaka.util.Error.Code.FAILED_TO_ATTACH_TO_VIDEO,b.message));case 5:a.destroyer_.ensureNotDestroyed(),c.jumpToEnd()}})};
|
|
447
447
|
shaka.media.DrmEngine.prototype.onEncryptedEvent_=function(a){var b=this;return $jscomp.asyncExecutePromiseGeneratorProgram(function(c){if(1==c.nextAddress)return c.yield(b.attachMediaKeys_(),2);b.newInitData(a.initDataType,shaka.util.BufferUtils.toUint8(a.initData));c.jumpToEnd()})};
|
|
448
|
-
shaka.media.DrmEngine.prototype.attach=function(a){var b=this
|
|
449
|
-
b.video_&&b.eventManager_.listen(b.video_,"webkitcurrentplaybacktargetiswirelesschanged",function(){return b.closeOpenSessions_()});
|
|
450
|
-
d.jumpToEnd()})};
|
|
451
|
-
shaka.media.DrmEngine.prototype.setServerCertificate=function(){var a=this,b,c,d,e,f,g;return $jscomp.asyncExecutePromiseGeneratorProgram(function(h){switch(h.nextAddress){case 1:goog.asserts.assert(a.initialized_,"Must call init() before setServerCertificate");if(!a.mediaKeys_||!a.currentDrmInfo_)return h.return();if(!a.currentDrmInfo_.serverCertificateUri||a.currentDrmInfo_.serverCertificate&&a.currentDrmInfo_.serverCertificate.length){h.jumpTo(2);break}b=shaka.net.NetworkingEngine.makeRequest([a.currentDrmInfo_.serverCertificateUri],
|
|
452
|
-
h.setCatchFinallyBlocks(3);c=a.playerInterface_.netEngine.request(shaka.net.NetworkingEngine.RequestType.SERVER_CERTIFICATE,b);return h.yield(c.promise,5);case 5:d=h.yieldResult;a.currentDrmInfo_.serverCertificate=shaka.util.BufferUtils.toUint8(d.data);h.leaveTryBlock(4);break;case 3:throw e=h.enterCatchBlock(),goog.asserts.assert(e instanceof shaka.util.Error,"Wrong NetworkingEngine error type!"),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.DRM,
|
|
453
|
-
e);case 4:if(a.destroyer_.destroyed())return h.return();case 2:if(!a.currentDrmInfo_.serverCertificate||!a.currentDrmInfo_.serverCertificate.length)return h.return();h.setCatchFinallyBlocks(6);return h.yield(a.mediaKeys_.setServerCertificate(a.currentDrmInfo_.serverCertificate),8);case 8:(f=h.yieldResult)||shaka.log.warning("Server certificates are not supported by the key system. The server certificate has been ignored.");h.leaveTryBlock(0);
|
|
454
|
-
shaka.util.Error.Category.DRM,shaka.util.Error.Code.INVALID_SERVER_CERTIFICATE,g.message);}})};
|
|
448
|
+
shaka.media.DrmEngine.prototype.attach=function(a){var b=this;return $jscomp.asyncExecutePromiseGeneratorProgram(function(c){if(1==c.nextAddress){if(!b.mediaKeys_)return b.eventManager_.listenOnce(a,"encrypted",function(d){b.onError_(new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.DRM,shaka.util.Error.Code.ENCRYPTED_CONTENT_WITHOUT_DRM_INFO))}),c.return();b.video_=a;b.eventManager_.listenOnce(b.video_,"play",function(){return b.onPlay_()});"webkitCurrentPlaybackTargetIsWireless"in
|
|
449
|
+
b.video_&&b.eventManager_.listen(b.video_,"webkitcurrentplaybacktargetiswirelesschanged",function(){return b.closeOpenSessions_()});b.manifestInitData_=b.currentDrmInfo_?b.currentDrmInfo_.initData.find(function(d){return 0<d.initData.length})||null:null;return b.manifestInitData_||"com.apple.fps"!==b.currentDrmInfo_.keySystem||b.offlineSessionIds_.length?c.yield(b.attachMediaKeys_(),2):c.jumpTo(2)}b.createOrLoad();b.manifestInitData_||b.offlineSessionIds_.length||b.config_.parseInbandPsshEnabled||
|
|
450
|
+
b.eventManager_.listen(b.video_,"encrypted",function(d){return b.onEncryptedEvent_(d)});c.jumpToEnd()})};
|
|
451
|
+
shaka.media.DrmEngine.prototype.setServerCertificate=function(){var a=this,b,c,d,e,f,g;return $jscomp.asyncExecutePromiseGeneratorProgram(function(h){switch(h.nextAddress){case 1:goog.asserts.assert(a.initialized_,"Must call init() before setServerCertificate");if(!a.mediaKeys_||!a.currentDrmInfo_)return h.return();if(!a.currentDrmInfo_.serverCertificateUri||a.currentDrmInfo_.serverCertificate&&a.currentDrmInfo_.serverCertificate.length){h.jumpTo(2);break}b=shaka.net.NetworkingEngine.makeRequest([a.currentDrmInfo_.serverCertificateUri],
|
|
452
|
+
a.config_.retryParameters);h.setCatchFinallyBlocks(3);c=a.playerInterface_.netEngine.request(shaka.net.NetworkingEngine.RequestType.SERVER_CERTIFICATE,b);return h.yield(c.promise,5);case 5:d=h.yieldResult;a.currentDrmInfo_.serverCertificate=shaka.util.BufferUtils.toUint8(d.data);h.leaveTryBlock(4);break;case 3:throw e=h.enterCatchBlock(),goog.asserts.assert(e instanceof shaka.util.Error,"Wrong NetworkingEngine error type!"),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.DRM,
|
|
453
|
+
shaka.util.Error.Code.SERVER_CERTIFICATE_REQUEST_FAILED,e);case 4:if(a.destroyer_.destroyed())return h.return();case 2:if(!a.currentDrmInfo_.serverCertificate||!a.currentDrmInfo_.serverCertificate.length)return h.return();h.setCatchFinallyBlocks(6);return h.yield(a.mediaKeys_.setServerCertificate(a.currentDrmInfo_.serverCertificate),8);case 8:(f=h.yieldResult)||shaka.log.warning("Server certificates are not supported by the key system. The server certificate has been ignored.");h.leaveTryBlock(0);
|
|
454
|
+
break;case 6:throw g=h.enterCatchBlock(),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.DRM,shaka.util.Error.Code.INVALID_SERVER_CERTIFICATE,g.message);}})};
|
|
455
455
|
shaka.media.DrmEngine.prototype.removeSession=function(a){var b=this,c,d,e;return $jscomp.asyncExecutePromiseGeneratorProgram(function(f){if(1==f.nextAddress)return goog.asserts.assert(b.mediaKeys_,"Must call init() before removeSession"),f.yield(b.loadOfflineSession_(a),2);if(3!=f.nextAddress){c=f.yieldResult;if(!c)return shaka.log.v2("Ignoring attempt to remove missing session",a),f.return();d=[];if(e=b.activeSessions_.get(c))e.updatePromise=new shaka.util.PublicPromise,d.push(e.updatePromise);
|
|
456
456
|
shaka.log.v2("Attempting to remove session",a);d.push(c.remove());return f.yield(Promise.all(d),3)}b.activeSessions_.delete(c);f.jumpToEnd()})};
|
|
457
457
|
shaka.media.DrmEngine.prototype.createOrLoad=function(){for(var a=(this.currentDrmInfo_?this.currentDrmInfo_.initData:[])||[],b=$jscomp.makeIterator(a),c=b.next();!c.done;c=b.next())c=c.value,this.newInitData(c.initDataType,c.initData);b=$jscomp.makeIterator(this.offlineSessionIds_);for(c=b.next();!c.done;c=b.next())this.loadOfflineSession_(c.value);a.length||this.offlineSessionIds_.length||this.allSessionsLoaded_.resolve();return this.allSessionsLoaded_};
|
|
@@ -517,8 +517,8 @@ shaka.media.DrmEngine.processDrmInfos_=function(a,b,c,d,e,f){var g={};a=$jscomp.
|
|
|
517
517
|
m.$jscomp$loop$prop$initDataOverride$635;n=n.keyId&&n.keyId==p.keyId?!0:n.initDataType==p.initDataType&&shaka.util.BufferUtils.equal(n.initData,p.initData);return n}}(h))||e.push(h.$jscomp$loop$prop$initDataOverride$635)}if(g.$jscomp$loop$prop$drmInfo$633.keyIds)for(h=$jscomp.makeIterator(g.$jscomp$loop$prop$drmInfo$633.keyIds),k=h.next();!k.done;k=h.next())f.add(k.value)}};
|
|
518
518
|
shaka.media.DrmEngine.fillInDrmInfoDefaults_=function(a,b,c,d){var e=a.keySystem;if(e&&("org.w3.clearkey"!=e||!a.licenseServerUri)){b.size&&(b=b.get(e)||"",a.licenseServerUri=b);a.keyIds||(a.keyIds=new Set);if(c=c.get(e))a.distinctiveIdentifierRequired||(a.distinctiveIdentifierRequired=c.distinctiveIdentifierRequired),a.persistentStateRequired||(a.persistentStateRequired=c.persistentStateRequired),a.videoRobustness||(a.videoRobustness=c.videoRobustness),a.audioRobustness||(a.audioRobustness=c.audioRobustness),
|
|
519
519
|
a.serverCertificate||(a.serverCertificate=c.serverCertificate),c.sessionType&&(a.sessionType=c.sessionType),a.serverCertificateUri||(a.serverCertificateUri=c.serverCertificateUri);d[e]&&(a.keySystem=d[e]);window.cast&&window.cast.__platform__&&"com.microsoft.playready"==e&&(a.keySystem="com.chromecast.playready")}};
|
|
520
|
-
shaka.media.DrmEngine.prototype.parseInbandPssh=function(a,b){if(!this.config_.parseInbandPsshEnabled)return Promise.resolve();var c=shaka.util.ManifestParserUtils.ContentType;if(![c.AUDIO,c.VIDEO].includes(a))return Promise.resolve();b=new shaka.util.Pssh(shaka.util.BufferUtils.toUint8(b));c=0;var d=$jscomp.makeIterator(b.data);for(a=d.next();!a.done;a=d.next())c+=a.value.length;if(0==c)return Promise.resolve();c=new Uint8Array(c);d=0;b=$jscomp.makeIterator(b.data);for(a=
|
|
521
|
-
a.value,c.set(a,d),d+=a.length;this.newInitData("cenc",c);return this.allSessionsLoaded_};shaka.media.DrmEngine.CLOSE_TIMEOUT_=1;shaka.media.DrmEngine.SESSION_LOAD_TIMEOUT_=5;shaka.media.DrmEngine.KEY_STATUS_BATCH_TIME=.5;shaka.media.DrmEngine.DUMMY_KEY_ID=new shaka.util.Lazy(function(){return shaka.util.BufferUtils.toArrayBuffer(new Uint8Array([0]))});shaka.media.ManifestParser=function(){};shaka.media.ManifestParser.registerParserByExtension=function(a,b){shaka.media.ManifestParser.parsersByExtension[a]=b};shaka.media.ManifestParser.registerParserByMime=function(a,b){shaka.media.ManifestParser.parsersByMime[a]=b};shaka.media.ManifestParser.unregisterParserByMime=function(a){delete shaka.media.ManifestParser.parsersByMime[a]};
|
|
520
|
+
shaka.media.DrmEngine.prototype.parseInbandPssh=function(a,b){if(!this.config_.parseInbandPsshEnabled||this.manifestInitData_)return Promise.resolve();var c=shaka.util.ManifestParserUtils.ContentType;if(![c.AUDIO,c.VIDEO].includes(a))return Promise.resolve();b=new shaka.util.Pssh(shaka.util.BufferUtils.toUint8(b));c=0;var d=$jscomp.makeIterator(b.data);for(a=d.next();!a.done;a=d.next())c+=a.value.length;if(0==c)return Promise.resolve();c=new Uint8Array(c);d=0;b=$jscomp.makeIterator(b.data);for(a=
|
|
521
|
+
b.next();!a.done;a=b.next())a=a.value,c.set(a,d),d+=a.length;this.newInitData("cenc",c);return this.allSessionsLoaded_};shaka.media.DrmEngine.CLOSE_TIMEOUT_=1;shaka.media.DrmEngine.SESSION_LOAD_TIMEOUT_=5;shaka.media.DrmEngine.KEY_STATUS_BATCH_TIME=.5;shaka.media.DrmEngine.DUMMY_KEY_ID=new shaka.util.Lazy(function(){return shaka.util.BufferUtils.toArrayBuffer(new Uint8Array([0]))});shaka.media.ManifestParser=function(){};shaka.media.ManifestParser.registerParserByExtension=function(a,b){shaka.media.ManifestParser.parsersByExtension[a]=b};shaka.media.ManifestParser.registerParserByMime=function(a,b){shaka.media.ManifestParser.parsersByMime[a]=b};shaka.media.ManifestParser.unregisterParserByMime=function(a){delete shaka.media.ManifestParser.parsersByMime[a]};
|
|
522
522
|
shaka.media.ManifestParser.probeSupport=function(){var a=shaka.media.ManifestParser,b={};if(shaka.util.Platform.supportsMediaSource()){for(var c in a.parsersByMime)b[c]=!0;for(var d in a.parsersByExtension)b[d]=!0}c={mpd:"application/dash+xml",m3u8:"application/x-mpegurl",ism:"application/vnd.ms-sstr+xml"};d=$jscomp.makeIterator(["application/dash+xml","application/x-mpegurl","application/vnd.apple.mpegurl","application/vnd.ms-sstr+xml"]);for(var e=d.next();!e.done;e=d.next())e=e.value,shaka.util.Platform.supportsMediaSource()?
|
|
523
523
|
b[e]=!!a.parsersByMime[e]:b[e]=shaka.util.Platform.supportsMediaType(e);for(var f in c)shaka.util.Platform.supportsMediaSource()?b[f]=!!a.parsersByExtension[f]:b[f]=shaka.util.Platform.supportsMediaType(c[f]);return b};
|
|
524
524
|
shaka.media.ManifestParser.getFactory=function(a,b,c,d){var e,f,g,h,k;return $jscomp.asyncExecutePromiseGeneratorProgram(function(l){if(1==l.nextAddress){e=shaka.media.ManifestParser;if(d){if(f=e.parsersByMime[d.toLowerCase()])return l.return(f);shaka.log.warning("Could not determine manifest type using MIME type ",d)}if(g=e.getExtension(a)){if(h=e.parsersByExtension[g])return l.return(h);shaka.log.warning("Could not determine manifest type for extension ",g)}else shaka.log.warning("Could not find extension for ",
|
|
@@ -618,20 +618,21 @@ d):b+d,h++,k=f.length>h?f[h].sampleSize||e:e)}};shaka.media.IClosedCaptionParser
|
|
|
618
618
|
shaka.media.ClosedCaptionParser.prototype.parseFrom=function(a){a=this.ceaParser_.parse(a);a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next()){b=b.value;var c=shaka.util.BufferUtils.toUint8(b.packet);0<c.length&&this.ceaDecoder_.extract(c,b.pts)}return this.ceaDecoder_.decode()};shaka.media.ClosedCaptionParser.prototype.reset=function(){this.ceaDecoder_.clear()};shaka.media.InitSegmentReference=function(a,b,c,d){this.getUris=a;this.startByte=b;this.endByte=c;this.mediaQuality=void 0===d?null:d};shaka.media.InitSegmentReference.prototype.getStartByte=function(){return this.startByte};shaka.media.InitSegmentReference.prototype.getEndByte=function(){return this.endByte};shaka.media.InitSegmentReference.prototype.getSize=function(){return this.endByte?this.endByte-this.startByte:null};shaka.media.InitSegmentReference.prototype.getMediaQuality=function(){return this.mediaQuality};
|
|
619
619
|
shaka.media.InitSegmentReference.equal=function(a,b){var c=shaka.util.ArrayUtils;return a&&b?a.getStartByte()==b.getStartByte()&&a.getEndByte()==b.getEndByte()&&c.equal(a.getUris(),b.getUris()):a==b};goog.exportSymbol("shaka.media.InitSegmentReference",shaka.media.InitSegmentReference);goog.exportProperty(shaka.media.InitSegmentReference.prototype,"getEndByte",shaka.media.InitSegmentReference.prototype.getEndByte);goog.exportProperty(shaka.media.InitSegmentReference.prototype,"getStartByte",shaka.media.InitSegmentReference.prototype.getStartByte);
|
|
620
620
|
shaka.media.SegmentReference=function(a,b,c,d,e,f,g,h,k,l,m,n,p,q,r){l=void 0===l?[]:l;m=void 0===m?"":m;n=void 0===n?null:n;p=void 0===p?null:p;q=void 0===q?shaka.media.SegmentReference.Status.AVAILABLE:q;r=void 0===r?null:r;goog.asserts.assert(a<=b,"startTime must be less than or equal to endTime");goog.asserts.assert(null==e||d<e,"startByte must be < endByte");this.startTime=a;this.trueEndTime=this.endTime=b;this.getUrisInner=c;this.startByte=d;this.endByte=e;this.initSegmentReference=f;this.timestampOffset=
|
|
621
|
-
g;this.appendWindowStart=h;this.appendWindowEnd=k;this.partialReferences=l;this.tilesLayout=m;this.tileDuration=n;this.syncTime=p;this.status=q;this.hlsAes128Key=r;this.discontinuitySequence=0};shaka.media.SegmentReference.prototype.getUris=function(){return this.getUrisInner()};shaka.media.SegmentReference.prototype.getStartTime=function(){return this.startTime};shaka.media.SegmentReference.prototype.getEndTime=function(){return this.endTime};
|
|
622
|
-
shaka.media.SegmentReference.prototype.getEndByte=function(){return this.endByte};shaka.media.SegmentReference.prototype.getSize=function(){return this.endByte?this.endByte-this.startByte:null};shaka.media.SegmentReference.prototype.hasPartialSegments=function(){return 0<this.partialReferences.length};shaka.media.SegmentReference.prototype.getTilesLayout=function(){return this.tilesLayout};
|
|
623
|
-
shaka.media.SegmentReference.prototype.getStatus=function(){return this.status};shaka.media.SegmentReference.prototype.markAsUnavailable=function(){this.status=shaka.media.SegmentReference.Status.UNAVAILABLE};shaka.media.SegmentReference.prototype.
|
|
624
|
-
shaka.media.SegmentReference.prototype.syncAgainst=function(a){null==this.syncTime?shaka.log.alwaysError("Sync attempted without sync time!"):(a=this.syncTime-a-this.startTime,.001<=Math.abs(a)&&this.offset(a))};
|
|
625
|
-
goog.
|
|
626
|
-
goog.exportProperty(shaka.media.SegmentReference.prototype,"
|
|
627
|
-
goog.exportProperty(shaka.media.SegmentReference.prototype,"
|
|
621
|
+
g;this.appendWindowStart=h;this.appendWindowEnd=k;this.partialReferences=l;this.tilesLayout=m;this.tileDuration=n;this.syncTime=p;this.status=q;this.preload=!1;this.hlsAes128Key=r;this.discontinuitySequence=0};shaka.media.SegmentReference.prototype.getUris=function(){return this.getUrisInner()};shaka.media.SegmentReference.prototype.getStartTime=function(){return this.startTime};shaka.media.SegmentReference.prototype.getEndTime=function(){return this.endTime};
|
|
622
|
+
shaka.media.SegmentReference.prototype.getStartByte=function(){return this.startByte};shaka.media.SegmentReference.prototype.getEndByte=function(){return this.endByte};shaka.media.SegmentReference.prototype.getSize=function(){return this.endByte?this.endByte-this.startByte:null};shaka.media.SegmentReference.prototype.hasPartialSegments=function(){return 0<this.partialReferences.length};shaka.media.SegmentReference.prototype.getTilesLayout=function(){return this.tilesLayout};
|
|
623
|
+
shaka.media.SegmentReference.prototype.getTileDuration=function(){return this.tileDuration};shaka.media.SegmentReference.prototype.getStatus=function(){return this.status};shaka.media.SegmentReference.prototype.markAsUnavailable=function(){this.status=shaka.media.SegmentReference.Status.UNAVAILABLE};shaka.media.SegmentReference.prototype.markAsPreload=function(){this.preload=!0};shaka.media.SegmentReference.prototype.isPreload=function(){return this.preload};
|
|
624
|
+
shaka.media.SegmentReference.prototype.offset=function(a){this.startTime+=a;this.endTime+=a;this.trueEndTime+=a;for(var b=$jscomp.makeIterator(this.partialReferences),c=b.next();!c.done;c=b.next())c=c.value,c.startTime+=a,c.endTime+=a,c.trueEndTime+=a};shaka.media.SegmentReference.prototype.syncAgainst=function(a){null==this.syncTime?shaka.log.alwaysError("Sync attempted without sync time!"):(a=this.syncTime-a-this.startTime,.001<=Math.abs(a)&&this.offset(a))};
|
|
625
|
+
goog.exportSymbol("shaka.media.SegmentReference",shaka.media.SegmentReference);goog.exportProperty(shaka.media.SegmentReference.prototype,"syncAgainst",shaka.media.SegmentReference.prototype.syncAgainst);goog.exportProperty(shaka.media.SegmentReference.prototype,"offset",shaka.media.SegmentReference.prototype.offset);goog.exportProperty(shaka.media.SegmentReference.prototype,"isPreload",shaka.media.SegmentReference.prototype.isPreload);
|
|
626
|
+
goog.exportProperty(shaka.media.SegmentReference.prototype,"markAsPreload",shaka.media.SegmentReference.prototype.markAsPreload);goog.exportProperty(shaka.media.SegmentReference.prototype,"markAsUnavailable",shaka.media.SegmentReference.prototype.markAsUnavailable);goog.exportProperty(shaka.media.SegmentReference.prototype,"getStatus",shaka.media.SegmentReference.prototype.getStatus);goog.exportProperty(shaka.media.SegmentReference.prototype,"getTileDuration",shaka.media.SegmentReference.prototype.getTileDuration);
|
|
627
|
+
goog.exportProperty(shaka.media.SegmentReference.prototype,"getTilesLayout",shaka.media.SegmentReference.prototype.getTilesLayout);goog.exportProperty(shaka.media.SegmentReference.prototype,"getEndByte",shaka.media.SegmentReference.prototype.getEndByte);goog.exportProperty(shaka.media.SegmentReference.prototype,"getStartByte",shaka.media.SegmentReference.prototype.getStartByte);goog.exportProperty(shaka.media.SegmentReference.prototype,"getEndTime",shaka.media.SegmentReference.prototype.getEndTime);
|
|
628
|
+
goog.exportProperty(shaka.media.SegmentReference.prototype,"getStartTime",shaka.media.SegmentReference.prototype.getStartTime);goog.exportProperty(shaka.media.SegmentReference.prototype,"getUris",shaka.media.SegmentReference.prototype.getUris);shaka.media.SegmentReference.Status={AVAILABLE:0,UNAVAILABLE:1,MISSING:2};goog.exportProperty(shaka.media.SegmentReference,"Status",shaka.media.SegmentReference.Status);shaka.media.TimeRangesUtils=function(){};shaka.media.TimeRangesUtils.bufferStart=function(a){return!a||1==a.length&&1E-6>a.end(0)-a.start(0)?null:1==a.length&&0>a.start(0)?0:a.length?a.start(0):null};shaka.media.TimeRangesUtils.bufferEnd=function(a){return!a||1==a.length&&1E-6>a.end(0)-a.start(0)?null:a.length?a.end(a.length-1):null};shaka.media.TimeRangesUtils.isBuffered=function(a,b){return!a||!a.length||1==a.length&&1E-6>a.end(0)-a.start(0)||b>a.end(a.length-1)?!1:b>=a.start(0)};
|
|
628
629
|
shaka.media.TimeRangesUtils.bufferedAheadOf=function(a,b){if(!a||!a.length||1==a.length&&1E-6>a.end(0)-a.start(0))return 0;var c=0;a=$jscomp.makeIterator(shaka.media.TimeRangesUtils.getBufferedInfo(a));for(var d=a.next();!d.done;d=a.next()){var e=d.value;d=e.start;e=e.end;e>b&&(c+=e-Math.max(d,b))}return c};
|
|
629
630
|
shaka.media.TimeRangesUtils.getGapIndex=function(a,b,c){var d=shaka.media.TimeRangesUtils;if(!a||!a.length||1==a.length&&1E-6>a.end(0)-a.start(0))return null;a=d.getBufferedInfo(a).findIndex(function(e,f,g){return e.start>b&&(0==f||g[f-1].end-b<=c)});return 0<=a?a:null};shaka.media.TimeRangesUtils.getBufferedInfo=function(a){if(!a)return[];for(var b=[],c=0;c<a.length;c++)b.push({start:a.start(c),end:a.end(c)});return b};
|
|
630
|
-
shaka.media.TimeRangesUtils.computeAddedRange=function(a,b){var c=shaka.media.TimeRangesUtils;if(!a||!a.length)return null;if(!b||!b.length)return c.getBufferedInfo(b).pop();b=c.getBufferedInfo(b).reverse();a=c.getBufferedInfo(a).reverse();c=$jscomp.makeIterator(b);for(b=c.next();!b.done;b=c.next()){b=b.value;for(var d=!1,e=$jscomp.makeIterator(a),f=e.next();!f.done;f=e.next())if(f=f.value,f.end>=b.start&&f.end<=b.end&&(d=!0,b.end>f.end))return{start:f.end,end:b.end};if(!d)return b}return null};shaka.media.MediaSourceEngine=function(a,b,c,d){var e=this;this.video_=a;this.textDisplayer_=c;this.sourceBuffers_={};this.sourceBufferTypes_={};this.expectedEncryption_={};this.textEngine_=null;this.segmentRelativeVttTiming_=!1;a=function(f,g,h){};this.onMetadata_=d||a;this.queues_={};this.eventManager_=new shaka.util.EventManager;this.transmuxers_={};this.captionParser_=b;this.mediaSourceOpen_=new shaka.util.PublicPromise;this.mediaSource_=this.createMediaSource(this.mediaSourceOpen_);
|
|
631
|
-
new shaka.util.Destroyer(function(){return e.doDestroy_()});this.
|
|
632
|
-
shaka.media.MediaSourceEngine.prototype.onSourceOpen_=function(a){URL.revokeObjectURL(this.url_);a.resolve()};shaka.media.MediaSourceEngine.isStreamSupported=function(a){var b=shaka.util.MimeUtils.getFullType(a.mimeType,a.codecs),c=shaka.util.MimeUtils.getExtendedType(a);return shaka.text.TextEngine.isTypeSupported(b)||MediaSource.isTypeSupported(c)||shaka.media.Transmuxer.isSupported(b,a.type)};
|
|
633
|
-
shaka.media.MediaSourceEngine.probeSupport=function(){var a='video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hev1.1.6.L93.90",video/mp4; codecs="hvc1.1.6.L93.90",video/mp4; codecs="hev1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="hvc1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="vp9",video/mp4; codecs="vp09.00.10.08",video/mp4; codecs="av01.0.01M.08",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",audio/mp4; codecs="opus",audio/mp4; codecs="flac",audio/mp4; codecs="dtsc",audio/mp4; codecs="dtse",audio/mp4; codecs="dtsx",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="vp09.00.10.08",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",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",").concat($jscomp.arrayFromIterable(shaka.media.MediaSourceEngine.RAW_FORMATS)),
|
|
634
|
-
{};a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;shaka.util.Platform.supportsMediaSource()?shaka.text.TextEngine.isTypeSupported(c)?b[c]=!0:b[c]=MediaSource.isTypeSupported(c)||shaka.media.Transmuxer.isSupported(c):b[c]=shaka.util.Platform.supportsMediaType(c);var d=c.split(";")[0];b[d]=b[d]||b[c]}return b};shaka.media.MediaSourceEngine.prototype.destroy=function(){return this.destroyer_.destroy()};
|
|
631
|
+
shaka.media.TimeRangesUtils.computeAddedRange=function(a,b){var c=shaka.media.TimeRangesUtils;if(!a||!a.length)return null;if(!b||!b.length)return c.getBufferedInfo(b).pop();b=c.getBufferedInfo(b).reverse();a=c.getBufferedInfo(a).reverse();c=$jscomp.makeIterator(b);for(b=c.next();!b.done;b=c.next()){b=b.value;for(var d=!1,e=$jscomp.makeIterator(a),f=e.next();!f.done;f=e.next())if(f=f.value,f.end>=b.start&&f.end<=b.end&&(d=!0,b.end>f.end))return{start:f.end,end:b.end};if(!d)return b}return null};shaka.media.MediaSourceEngine=function(a,b,c,d){var e=this;this.video_=a;this.textDisplayer_=c;this.sourceBuffers_={};this.sourceBufferTypes_={};this.expectedEncryption_={};this.textEngine_=null;this.segmentRelativeVttTiming_=!1;a=function(f,g,h){};this.onMetadata_=d||a;this.queues_={};this.eventManager_=new shaka.util.EventManager;this.transmuxers_={};this.captionParser_=b;this.mediaSourceOpen_=new shaka.util.PublicPromise;this.url_="";this.mediaSource_=this.createMediaSource(this.mediaSourceOpen_);
|
|
632
|
+
this.destroyer_=new shaka.util.Destroyer(function(){return e.doDestroy_()});this.sequenceMode_=!1;this.textSequenceModeOffset_=new shaka.util.PublicPromise};shaka.media.MediaSourceEngine.prototype.createMediaSource=function(a){var b=this,c=new MediaSource;this.eventManager_.listenOnce(c,"sourceopen",function(){return b.onSourceOpen_(a)});this.url_=shaka.media.MediaSourceEngine.createObjectURL(c);this.video_.src=this.url_;return c};
|
|
633
|
+
shaka.media.MediaSourceEngine.prototype.onSourceOpen_=function(a){goog.asserts.assert(this.url_,"Must have object URL");URL.revokeObjectURL(this.url_);a.resolve()};shaka.media.MediaSourceEngine.isStreamSupported=function(a){var b=shaka.util.MimeUtils.getFullType(a.mimeType,a.codecs),c=shaka.util.MimeUtils.getExtendedType(a);return shaka.text.TextEngine.isTypeSupported(b)||MediaSource.isTypeSupported(c)||shaka.media.Transmuxer.isSupported(b,a.type)};
|
|
634
|
+
shaka.media.MediaSourceEngine.probeSupport=function(){var a='video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hev1.1.6.L93.90",video/mp4; codecs="hvc1.1.6.L93.90",video/mp4; codecs="hev1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="hvc1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="vp9",video/mp4; codecs="vp09.00.10.08",video/mp4; codecs="av01.0.01M.08",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",audio/mp4; codecs="opus",audio/mp4; codecs="flac",audio/mp4; codecs="dtsc",audio/mp4; codecs="dtse",audio/mp4; codecs="dtsx",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="vp09.00.10.08",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",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",").concat($jscomp.arrayFromIterable(shaka.media.MediaSourceEngine.RAW_FORMATS)),
|
|
635
|
+
b={};a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;shaka.util.Platform.supportsMediaSource()?shaka.text.TextEngine.isTypeSupported(c)?b[c]=!0:b[c]=MediaSource.isTypeSupported(c)||shaka.media.Transmuxer.isSupported(c):b[c]=shaka.util.Platform.supportsMediaType(c);var d=c.split(";")[0];b[d]=b[d]||b[c]}return b};shaka.media.MediaSourceEngine.prototype.destroy=function(){return this.destroyer_.destroy()};
|
|
635
636
|
shaka.media.MediaSourceEngine.prototype.doDestroy_=function(){var a=this,b,c,d,e,f,g,h,k,l,m;return $jscomp.asyncExecutePromiseGeneratorProgram(function(n){if(1==n.nextAddress){b=shaka.util.Functional;c=[];for(d in a.queues_)for(e=a.queues_[d],f=e[0],a.queues_[d]=e.slice(0,1),f&&c.push(f.p.catch(b.noop)),g=$jscomp.makeIterator(e.slice(1)),h=g.next();!h.done;h=g.next())k=h.value,k.p.reject(shaka.util.Destroyer.destroyedError());a.textEngine_&&c.push(a.textEngine_.destroy());a.textDisplayer_&&c.push(a.textDisplayer_.destroy());
|
|
636
637
|
for(l in a.transmuxers_)c.push(a.transmuxers_[l].destroy());return n.yield(Promise.all(c),2)}a.eventManager_&&(a.eventManager_.release(),a.eventManager_=null);a.video_&&(a.video_.removeAttribute("src"),a.video_.load(),a.video_=null);a.mediaSource_=null;a.textEngine_=null;a.textDisplayer_=null;a.sourceBuffers_={};a.transmuxers_={};a.captionParser_=null;if(goog.DEBUG)for(m in a.queues_)goog.asserts.assert(0==a.queues_[m].length,m+" queue should be empty after destroy!");a.queues_={};n.jumpToEnd()})};
|
|
637
638
|
shaka.media.MediaSourceEngine.prototype.open=function(){return this.mediaSourceOpen_};
|
|
@@ -648,8 +649,8 @@ c?c.startTime:null,c?c.endTime:null),5);case 5:return F.return();case 2:if(!g.tr
|
|
|
648
649
|
g.textEngine_||g.reinitText(shaka.util.MimeUtils.CEA608_CLOSED_CAPTION_MIMETYPE,g.sequenceMode_),n.metadata&&(p=g.sourceBuffers_[a].timestampOffset,g.onMetadata_(n.metadata,p,c?c.endTime:null)),n.captions&&n.captions.length&&(q=g.sourceBuffers_[h.VIDEO].timestampOffset,r=g.textEngine_.convertMuxjsCaptionsToShakaCaptions(n.captions),g.textEngine_.storeAndAppendClosedCaptions(r,c?c.startTime:null,c?c.endTime:null,q)),b=n.data;case 6:b=g.workAroundBrokenPlatforms_(b,c?c.startTime:null,a);t=g.sourceBuffers_[a];
|
|
649
650
|
v=shaka.media.MediaSourceEngine.SourceBufferMode_.SEQUENCE;if(!g.sequenceMode_||t.mode==v||!c){F.jumpTo(8);break}u=g.mediaSource_.duration;x=a==h.VIDEO||!(h.VIDEO in g.sourceBuffers_);if(!x){F.jumpTo(9);break}w=[t.appendWindowStart,t.appendWindowEnd];t.appendWindowStart=0;t.appendWindowEnd=Infinity;y=t.timestampOffset;t.timestampOffset=0;return F.yield(g.enqueueOperation_(a,function(){return g.append_(a,b)}),10);case 10:return F.yield(g.enqueueOperation_(a,function(){return g.abort_(a)}),11);case 11:return t.timestampOffset=
|
|
650
651
|
y,t.appendWindowStart=w[0],t.appendWindowEnd=w[1],A=shaka.media.TimeRangesUtils.bufferStart(g.getBuffered_(a)),z=(c.startTime||0)-(A||0),g.textSequenceModeOffset_.resolve(z),F.yield(g.enqueueOperation_(a,function(){return g.remove_(a,0,u)}),12);case 12:if(a!=h.VIDEO){F.jumpTo(9);break}return F.yield(g.enqueueOperation_(a,function(){return g.flush_(a)}),9);case 9:return t.mode=v,F.yield(g.setDuration(u),8);case 8:return c&&g.sequenceMode_&&a!=h.TEXT&&(e||f)&&(B=c.startTime,g.enqueueOperation_(a,function(){return g.abort_(a)}),
|
|
651
|
-
g.enqueueOperation_(a,function(){return g.setTimestampOffset_(a,B)})),G=null,F.yield(g.enqueueOperation_(a,function(){goog.DEBUG&&c&&(G=g.getBuffered_(a));g.append_(a,b)}),16);case 16:goog.DEBUG&&c&&(H=g.getBuffered_(a),C=shaka.media.TimeRangesUtils.computeAddedRange(G,H))&&(E=c.endTime-c.startTime,D=Math.abs(C.end-c.endTime),.1<E&&D>E/2&&shaka.log.error("Possible encoding problem detected!","Unexpected buffered range for reference",c,"from URIs",c.getUris(),"should be",{start:c.startTime,
|
|
652
|
-
"but got",C)),F.jumpToEnd()}})};shaka.media.MediaSourceEngine.prototype.setSelectedClosedCaptionId=function(a){var b=this.bufferEnd(shaka.util.ManifestParserUtils.ContentType.VIDEO)||0;this.textEngine_.setSelectedClosedCaptionId(a,b)};shaka.media.MediaSourceEngine.prototype.clearSelectedClosedCaptionId=function(){this.textEngine_&&this.textEngine_.setSelectedClosedCaptionId("",0)};
|
|
652
|
+
g.enqueueOperation_(a,function(){return g.setTimestampOffset_(a,B)})),G=null,F.yield(g.enqueueOperation_(a,function(){goog.DEBUG&&c&&(G=g.getBuffered_(a));g.append_(a,b)}),16);case 16:goog.DEBUG&&c&&!c.isPreload()&&(H=g.getBuffered_(a),C=shaka.media.TimeRangesUtils.computeAddedRange(G,H))&&(E=c.endTime-c.startTime,D=Math.abs(C.end-c.endTime),.1<E&&D>E/2&&shaka.log.error("Possible encoding problem detected!","Unexpected buffered range for reference",c,"from URIs",c.getUris(),"should be",{start:c.startTime,
|
|
653
|
+
end:c.endTime},"but got",C)),F.jumpToEnd()}})};shaka.media.MediaSourceEngine.prototype.setSelectedClosedCaptionId=function(a){var b=this.bufferEnd(shaka.util.ManifestParserUtils.ContentType.VIDEO)||0;this.textEngine_.setSelectedClosedCaptionId(a,b)};shaka.media.MediaSourceEngine.prototype.clearSelectedClosedCaptionId=function(){this.textEngine_&&this.textEngine_.setSelectedClosedCaptionId("",0)};
|
|
653
654
|
shaka.media.MediaSourceEngine.prototype.remove=function(a,b,c){var d=this,e;return $jscomp.asyncExecutePromiseGeneratorProgram(function(f){e=shaka.util.ManifestParserUtils.ContentType;return a==e.TEXT?f.yield(d.textEngine_.remove(b,c),0):f.yield(d.enqueueOperation_(a,function(){return d.remove_(a,b,c)}),0)})};
|
|
654
655
|
shaka.media.MediaSourceEngine.prototype.clear=function(a){var b=this,c;return $jscomp.asyncExecutePromiseGeneratorProgram(function(d){c=shaka.util.ManifestParserUtils.ContentType;return a==c.TEXT?b.textEngine_?d.yield(b.textEngine_.remove(0,Infinity),0):d.return():d.yield(b.enqueueOperation_(a,function(){return b.remove_(a,0,b.mediaSource_.duration)}),0)})};shaka.media.MediaSourceEngine.prototype.resetCaptionParser=function(){this.captionParser_.reset()};
|
|
655
656
|
shaka.media.MediaSourceEngine.prototype.flush=function(a){var b=this,c;return $jscomp.asyncExecutePromiseGeneratorProgram(function(d){c=shaka.util.ManifestParserUtils.ContentType;return a==c.TEXT?d.return():d.yield(b.enqueueOperation_(a,function(){return b.flush_(a)}),0)})};
|
|
@@ -783,8 +784,8 @@ shaka.media.StreamingEngine.prototype.makeAbortDecision_=function(a){var b=this,
|
|
|
783
784
|
a.operation.abort());e.jumpToEnd()})};
|
|
784
785
|
shaka.media.StreamingEngine.prototype.shouldAbortCurrentRequest_=function(a){goog.asserts.assert(a.operation,"Abort logic requires an ongoing operation!");goog.asserts.assert(a.stream&&a.stream.segmentIndex,"Abort logic requires a segment index");var b=this.playerInterface_.getPresentationTime(),c=this.playerInterface_.mediaSourceEngine.bufferEnd(a.type),d=this.getTimeNeeded_(a,b);d=a.stream.segmentIndex.find(d);var e=null==d?null:a.stream.segmentIndex.get(d);d=e?e.getSize():null;e&&!d&&(d=(e.getEndTime()-
|
|
785
786
|
e.getStartTime())*(a.stream.bandwidth||0)/8);if(!d)return!1;(e=e.initSegmentReference)&&(d+=e.getSize()||0);e=this.playerInterface_.getBandwidthEstimate();return 8*d/e<(c||0)-b-Math.max(this.manifest_.minBufferTime||0,this.config_.rebufferingGoal)||a.operation.getBytesRemaining()>d?!0:!1};
|
|
786
|
-
shaka.media.StreamingEngine.prototype.seeked=function(){if(this.playerInterface_){for(var a=this.playerInterface_.getPresentationTime(),b=shaka.util.ManifestParserUtils.ContentType,c=!1,d=$jscomp.makeIterator(this.mediaStates_.keys()),e=d.next();!e.done;e=d.next()){e=e.value;var f=this.mediaStates_.get(e),g=shaka.media.StreamingEngine.logPrefix_(f);f.segmentIterator=
|
|
787
|
-
c=!0;f.operation&&(f.operation.abort(),shaka.log.debug(g,"Aborting operation due to seek"),f.operation=null);e===b.TEXT&&this.playerInterface_.mediaSourceEngine.resetCaptionParser();f.seeked=!0}}c||shaka.log.debug("(all): seeked: buffered seek: presentationTime="+a)}};
|
|
787
|
+
shaka.media.StreamingEngine.prototype.seeked=function(){if(this.playerInterface_){for(var a=this.playerInterface_.getPresentationTime(),b=shaka.util.ManifestParserUtils.ContentType,c=!1,d=$jscomp.makeIterator(this.mediaStates_.keys()),e=d.next();!e.done;e=d.next()){e=e.value;var f=this.mediaStates_.get(e),g=shaka.media.StreamingEngine.logPrefix_(f),h=null;f.segmentIterator&&(h=f.segmentIterator.current());if(!h||h.startTime>a||h.endTime<a)f.segmentIterator=null;if(!this.playerInterface_.mediaSourceEngine.isBuffered(e,
|
|
788
|
+
a)){if(null!=this.playerInterface_.mediaSourceEngine.bufferEnd(e)||f.performingUpdate)this.forceClearBuffer_(f),c=!0;f.operation&&(f.operation.abort(),shaka.log.debug(g,"Aborting operation due to seek"),f.operation=null);e===b.TEXT&&this.playerInterface_.mediaSourceEngine.resetCaptionParser();f.seeked=!0}}c||shaka.log.debug("(all): seeked: buffered seek: presentationTime="+a)}};
|
|
788
789
|
shaka.media.StreamingEngine.prototype.forceClearBuffer_=function(a){var b=this,c=shaka.media.StreamingEngine.logPrefix_(a);a.clearingBuffer?shaka.log.debug(c,"clear: already clearing the buffer"):a.waitingToClearBuffer?shaka.log.debug(c,"clear: already waiting"):a.performingUpdate?(shaka.log.debug(c,"clear: currently updating"),a.waitingToClearBuffer=!0,a.clearBufferSafeMargin=0):null==this.playerInterface_.mediaSourceEngine.bufferStart(a.type)?(shaka.log.debug(c,"clear: nothing buffered"),null==
|
|
789
790
|
a.updateTimer&&this.scheduleUpdate_(a,0)):(shaka.log.debug(c,"clear: handling right now"),this.cancelUpdate_(a),this.clearBuffer_(a,!1,0).catch(function(d){b.playerInterface_&&(goog.asserts.assert(d instanceof shaka.util.Error,"Wrong error type!"),b.playerInterface_.onError(d))}))};
|
|
790
791
|
shaka.media.StreamingEngine.prototype.initStreams_=function(){var a=this,b,c,d,e,f,g,h,k,l,m;return $jscomp.asyncExecutePromiseGeneratorProgram(function(n){if(1==n.nextAddress){b=shaka.util.ManifestParserUtils.ContentType;goog.asserts.assert(a.config_,"StreamingEngine configure() must be called before init()!");if(!a.currentVariant_)throw shaka.log.error("init: no Streams chosen"),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.STREAMING,shaka.util.Error.Code.STREAMING_ENGINE_STARTUP_INVALID_STATE);
|
|
@@ -1114,9 +1115,10 @@ shaka.Player.prototype.switch_=function(a,b,c){b=void 0===b?!1:b;c=void 0===c?0:
|
|
|
1114
1115
|
shaka.Player.prototype.onAdaptation_=function(a,b){a=(new Map).set("oldTrack",a).set("newTrack",b);a=this.makeEvent_(shaka.util.FakeEvent.EventName.Adaptation,a);this.delayDispatchEvent_(a)};shaka.Player.prototype.onTracksChanged_=function(){var a=this.makeEvent_(shaka.util.FakeEvent.EventName.TracksChanged);this.delayDispatchEvent_(a)};
|
|
1115
1116
|
shaka.Player.prototype.onVariantChanged_=function(a,b){a=(new Map).set("oldTrack",a).set("newTrack",b);a=this.makeEvent_(shaka.util.FakeEvent.EventName.VariantChanged,a);this.delayDispatchEvent_(a)};shaka.Player.prototype.onTextChanged_=function(){var a=this.makeEvent_(shaka.util.FakeEvent.EventName.TextChanged);this.delayDispatchEvent_(a)};shaka.Player.prototype.onTextTrackVisibility_=function(){var a=this.makeEvent_(shaka.util.FakeEvent.EventName.TextTrackVisibility);this.delayDispatchEvent_(a)};
|
|
1116
1117
|
shaka.Player.prototype.onAbrStatusChanged_=function(){var a=(new Map).set("newStatus",this.config_.abr.enabled);this.delayDispatchEvent_(this.makeEvent_(shaka.util.FakeEvent.EventName.AbrStatusChanged,a))};
|
|
1117
|
-
shaka.Player.prototype.tryToRecoverFromError_=function(a){if(a.code!=shaka.util.Error.Code.HTTP_ERROR&&a.code!=shaka.util.Error.Code.SEGMENT_MISSING||a.category!=shaka.util.Error.Category.NETWORK
|
|
1118
|
-
goog.asserts.assert(a,"Active variant should be found");for(var c=this.manifest_,d=$jscomp.makeIterator(c.variants),e=d.next();!e.done;e=d.next())e=e.value,e.id===a.id&&(e.disabledUntilTime=Date.now()/1E3+b);shaka.util.StreamUtils.applyRestrictions(c.variants,this.config_.restrictions,this.maxHwRes_);a=this.chooseVariant_();if(!a)return shaka.log.warning("Not enough variants to recover from error")
|
|
1119
|
-
!1
|
|
1118
|
+
shaka.Player.prototype.tryToRecoverFromError_=function(a){if(a.code!=shaka.util.Error.Code.HTTP_ERROR&&a.code!=shaka.util.Error.Code.SEGMENT_MISSING||a.category!=shaka.util.Error.Category.NETWORK||this.loadMode_!=shaka.Player.LoadMode.MEDIA_SOURCE)return!1;goog.asserts.assert(this.manifest_,"Should have manifest!");if(!navigator.onLine)return!1;var b=this.config_.streaming.maxDisabledTime;if(0==b)if(a.code==shaka.util.Error.Code.SEGMENT_MISSING)b=1;else return!1;a.code==shaka.util.Error.Code.HTTP_ERROR&&
|
|
1119
|
+
shaka.log.debug("Recoverable NETWORK HTTP_ERROR, trying to recover...");a=this.getVariantTracks().find(function(f){return f.active});goog.asserts.assert(a,"Active variant should be found");for(var c=this.manifest_,d=$jscomp.makeIterator(c.variants),e=d.next();!e.done;e=d.next())e=e.value,e.id===a.id&&(e.disabledUntilTime=Date.now()/1E3+b);shaka.util.StreamUtils.applyRestrictions(c.variants,this.config_.restrictions,this.maxHwRes_);a=this.chooseVariant_();if(!a)return shaka.log.warning("Not enough variants to recover from error"),
|
|
1120
|
+
!1;c=this.getBufferedInfo().video.reduce(function(f,g){return f+g.end-g.start},0);this.switchVariant_(a,!1,!0,c);this.checkVariantsTimer_.tickAfter(b);return!0};
|
|
1121
|
+
shaka.Player.prototype.onError_=function(a){goog.asserts.assert(a instanceof shaka.util.Error,"Wrong error type!");if(this.loadMode_!=shaka.Player.LoadMode.DESTROYED)if(this.tryToRecoverFromError_(a))a.handled=!0;else{var b=this.makeEvent_(shaka.util.FakeEvent.EventName.Error,(new Map).set("detail",a));this.dispatchEvent(b);b.defaultPrevented&&(a.handled=!0)}};
|
|
1120
1122
|
shaka.Player.prototype.onRegionEvent_=function(a,b){b={schemeIdUri:b.schemeIdUri,value:b.value,startTime:b.startTime,endTime:b.endTime,id:b.id,eventElement:b.eventElement};b=(new Map).set("detail",b);this.dispatchEvent(this.makeEvent_(a,b))};
|
|
1121
1123
|
shaka.Player.prototype.onMediaQualityChange_=function(a,b){a={bandwidth:a.bandwidth,audioSamplingRate:a.audioSamplingRate,codecs:a.codecs,contentType:a.contentType,frameRate:a.frameRate,height:a.height,mimeType:a.mimeType,channelsCount:a.channelsCount,pixelAspectRatio:a.pixelAspectRatio,width:a.width};b=(new Map).set("mediaQuality",a).set("position",b);this.dispatchEvent(this.makeEvent_(shaka.util.FakeEvent.EventName.MediaQualityChanged,b))};
|
|
1122
1124
|
shaka.Player.prototype.videoErrorToShakaError_=function(){goog.asserts.assert(this.video_.error,"Video error expected, but missing!");if(!this.video_.error)return null;var a=this.video_.error.code;if(1==a)return null;var b=this.video_.error.msExtendedCode;b&&(0>b&&(b+=Math.pow(2,32)),b=b.toString(16));return new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MEDIA,shaka.util.Error.Code.VIDEO_ERROR,a,b,this.video_.error.message)};
|
|
@@ -1150,7 +1152,7 @@ goog.exportProperty(shaka.Player.prototype,"goToLive",shaka.Player.prototype.goT
|
|
|
1150
1152
|
goog.exportProperty(shaka.Player.prototype,"getAdManager",shaka.Player.prototype.getAdManager);goog.exportProperty(shaka.Player.prototype,"getAssetUri",shaka.Player.prototype.getAssetUri);goog.exportProperty(shaka.Player.prototype,"getNetworkingEngine",shaka.Player.prototype.getNetworkingEngine);goog.exportProperty(shaka.Player.prototype,"getMediaElement",shaka.Player.prototype.getMediaElement);goog.exportProperty(shaka.Player.prototype,"getLoadMode",shaka.Player.prototype.getLoadMode);
|
|
1151
1153
|
goog.exportProperty(shaka.Player.prototype,"resetConfiguration",shaka.Player.prototype.resetConfiguration);goog.exportProperty(shaka.Player.prototype,"getBufferFullness",shaka.Player.prototype.getBufferFullness);goog.exportProperty(shaka.Player.prototype,"getConfiguration",shaka.Player.prototype.getConfiguration);goog.exportProperty(shaka.Player.prototype,"configure",shaka.Player.prototype.configure);goog.exportProperty(shaka.Player.prototype,"load",shaka.Player.prototype.load);
|
|
1152
1154
|
goog.exportProperty(shaka.Player.prototype,"updateStartTime",shaka.Player.prototype.updateStartTime);goog.exportProperty(shaka.Player.prototype,"unload",shaka.Player.prototype.unload);goog.exportProperty(shaka.Player.prototype,"detach",shaka.Player.prototype.detach);goog.exportProperty(shaka.Player.prototype,"attach",shaka.Player.prototype.attach);goog.exportProperty(shaka.Player,"probeSupport",shaka.Player.probeSupport);goog.exportProperty(shaka.Player,"isBrowserSupported",shaka.Player.isBrowserSupported);
|
|
1153
|
-
goog.exportProperty(shaka.Player,"setAdManagerFactory",shaka.Player.setAdManagerFactory);goog.exportProperty(shaka.Player,"registerSupportPlugin",shaka.Player.registerSupportPlugin);goog.exportProperty(shaka.Player.prototype,"destroy",shaka.Player.prototype.destroy);shaka.Player.LoadMode={DESTROYED:0,NOT_LOADED:1,MEDIA_SOURCE:2,SRC_EQUALS:3};goog.exportProperty(shaka.Player,"LoadMode",shaka.Player.LoadMode);shaka.Player.TYPICAL_BUFFERING_THRESHOLD_=.5;shaka.Player.version="v4.2.
|
|
1155
|
+
goog.exportProperty(shaka.Player,"setAdManagerFactory",shaka.Player.setAdManagerFactory);goog.exportProperty(shaka.Player,"registerSupportPlugin",shaka.Player.registerSupportPlugin);goog.exportProperty(shaka.Player.prototype,"destroy",shaka.Player.prototype.destroy);shaka.Player.LoadMode={DESTROYED:0,NOT_LOADED:1,MEDIA_SOURCE:2,SRC_EQUALS:3};goog.exportProperty(shaka.Player,"LoadMode",shaka.Player.LoadMode);shaka.Player.TYPICAL_BUFFERING_THRESHOLD_=.5;shaka.Player.version="v4.2.11-debug";
|
|
1154
1156
|
goog.exportProperty(shaka.Player,"version",shaka.Player.version);shaka.Deprecate.init(shaka.Player.version);shaka.Player.restrictedStatuses_=["output-restricted","internal-error"];shaka.Player.supportPlugins_={};shaka.Player.adManagerFactory_=null;
|
|
1155
1157
|
shaka.Player.SRC_EQUAL_EXTENSIONS_TO_MIME_TYPES_={mp4:"video/mp4",m4v:"video/mp4",m4a:"audio/mp4",webm:"video/webm",weba:"audio/webm",mkv:"video/webm",ts:"video/mp2t",ogv:"video/ogg",ogg:"audio/ogg",mpg:"video/mpeg",mpeg:"video/mpeg",m3u8:"application/x-mpegurl",mpd:"application/dash+xml",mp3:"audio/mpeg",aac:"audio/aac",flac:"audio/flac",wav:"audio/wav"};
|
|
1156
1158
|
shaka.Player.TEXT_EXTENSIONS_TO_MIME_TYPES_={sbv:"text/x-subviewer",srt:"text/srt",vtt:"text/vtt",webvtt:"text/vtt",ttml:"application/ttml+xml",lrc:"application/x-subtitle-lrc",ssa:"text/x-ssa",ass:"text/x-ssa"};shaka.Player.TextTrackLabel="Shaka Player TextTrack";shaka.ads={};shaka.ads.AdsStats=function(){this.loadTimes_=[];this.skipped_=this.playedCompletely_=this.started_=0};shaka.ads.AdsStats.prototype.addLoadTime=function(a){this.loadTimes_.push(a)};shaka.ads.AdsStats.prototype.incrementStarted=function(){this.started_++};shaka.ads.AdsStats.prototype.incrementPlayedCompletely=function(){this.playedCompletely_++};shaka.ads.AdsStats.prototype.incrementSkipped=function(){this.skipped_++};
|
|
@@ -1544,10 +1546,10 @@ shaka.util.TextParser.prototype.indexOf_=function(a){goog.asserts.assert(a.globa
|
|
|
1544
1546
|
shaka.hls.ManifestTextParser.prototype.parsePlaylist=function(a,b){var c=shaka.hls.ManifestTextParser.MEDIA_PLAYLIST_TAGS,d=shaka.hls.ManifestTextParser.SEGMENT_TAGS;a=shaka.util.StringUtils.fromUTF8(a);a=a.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n").trim();var e=a.split(/\n+/m);if(!/^#EXTM3U($|[ \t\n])/m.test(e[0]))throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.HLS_PLAYLIST_HEADER_MISSING);a=shaka.hls.PlaylistType.MASTER;for(var f=
|
|
1545
1547
|
!0,g=$jscomp.makeIterator(e),h=g.next();!h.done;h=g.next())if(h=h.value,shaka.hls.Utils.isComment(h)||f)f=!1;else if(h=this.parseTag_(h),--this.globalId_,c.includes(h.name)){a=shaka.hls.PlaylistType.MEDIA;break}else"EXT-X-STREAM-INF"==h.name&&(f=!0);c=[];f=!0;for(g=0;g<e.length;g++){var k=e[g];h=e[g+1];if(shaka.hls.Utils.isComment(k)||f)f=!1;else{k=this.parseTag_(k);if(d.includes(k.name)){if(a!=shaka.hls.PlaylistType.MEDIA)throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,
|
|
1546
1548
|
shaka.util.Error.Code.HLS_INVALID_PLAYLIST_HIERARCHY);d=e.splice(g,e.length-g);d=this.parseSegments_(b,d,c);return new shaka.hls.Playlist(b,a,c,d)}c.push(k);"EXT-X-STREAM-INF"==k.name&&(f=new shaka.hls.Attribute("URI",h),k.addAttribute(f),f=!0)}}return new shaka.hls.Playlist(b,a,c)};
|
|
1547
|
-
shaka.hls.ManifestTextParser.prototype.parseSegments_=function(a,b,c){var d=[],e=[],f=[],g=null;b=$jscomp.makeIterator(b);for(var h=b.next();!h.done;h=b.next())h=h.value,/^(#EXT)/.test(h)?(h=this.parseTag_(h),shaka.hls.ManifestTextParser.MEDIA_PLAYLIST_TAGS.includes(h.name)?c.push(h):"EXT-X-MAP"==h.name?g=h:"EXT-X-PART"==h.name?f.push(h):"EXT-X-PRELOAD-HINT"==h.name?"PART"==h.getAttributeValue("TYPE")?
|
|
1548
|
-
(h=h.trim(),h=shaka.hls.Utils.constructAbsoluteUri(a,h),g&&e.push(g),e=new shaka.hls.Segment(h,e,f),d.push(e),e=[],f=[]);f.length&&(g&&e.push(g),a=new shaka.hls.Segment("",e,f),d.push(a));return d};shaka.hls.ManifestTextParser.prototype.parseTag_=function(a){return shaka.hls.ManifestTextParser.parseTag(this.globalId_++,a)};
|
|
1549
|
+
shaka.hls.ManifestTextParser.prototype.parseSegments_=function(a,b,c){var d=[],e=[],f=[],g=null;b=$jscomp.makeIterator(b);for(var h=b.next();!h.done;h=b.next())h=h.value,/^(#EXT)/.test(h)?(h=this.parseTag_(h),shaka.hls.ManifestTextParser.MEDIA_PLAYLIST_TAGS.includes(h.name)?c.push(h):"EXT-X-MAP"==h.name?g=h:"EXT-X-PART"==h.name?f.push(h):"EXT-X-PRELOAD-HINT"==h.name?"PART"==h.getAttributeValue("TYPE")?null!=h.getAttributeValue("BYTERANGE-START")?null!=h.getAttributeValue("BYTERANGE-LENGTH")&&f.push(h):
|
|
1550
|
+
f.push(h):"MAP"==h.getAttributeValue("TYPE")&&(h.setName("EXT-X-MAP"),g=h):e.push(h)):shaka.hls.Utils.isComment(h)||(h=h.trim(),h=shaka.hls.Utils.constructAbsoluteUri(a,h),g&&e.push(g),e=new shaka.hls.Segment(h,e,f),d.push(e),e=[],f=[]);f.length&&(g&&e.push(g),a=new shaka.hls.Segment("",e,f),d.push(a));return d};shaka.hls.ManifestTextParser.prototype.parseTag_=function(a){return shaka.hls.ManifestTextParser.parseTag(this.globalId_++,a)};
|
|
1549
1551
|
shaka.hls.ManifestTextParser.parseTag=function(a,b){var c=b.match(/^#(EXT[^:]*)(?::(.*))?$/);if(!c)throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.INVALID_HLS_TAG,b);b=c[1];var d=c[2];c=[];var e;if(d){d=new shaka.util.TextParser(d);var f,g=d.readRegex(/^([^,=]+)(?:,|$)/g);g&&(e=g[1]);for(g=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g;f=d.readRegex(g);)f=new shaka.hls.Attribute(f[1],f[2]||f[3]),c.push(f),d.skipWhitespace()}return new shaka.hls.Tag(a,
|
|
1550
|
-
b,c,e)};shaka.hls.ManifestTextParser.MEDIA_PLAYLIST_TAGS="EXT-X-TARGETDURATION EXT-X-MEDIA-SEQUENCE EXT-X-DISCONTINUITY-SEQUENCE EXT-X-PLAYLIST-TYPE EXT-X-I-FRAMES-ONLY EXT-X-ENDLIST EXT-X-SERVER-CONTROL EXT-X-SKIP".split(" ");shaka.hls.ManifestTextParser.SEGMENT_TAGS="EXTINF EXT-X-BYTERANGE EXT-X-DISCONTINUITY EXT-X-PROGRAM-DATE-TIME EXT-X-KEY EXT-X-DATERANGE EXT-X-MAP".split(" ");shaka.net.DataUriPlugin=function(){};shaka.net.DataUriPlugin.parse=function(a,b,c,d){try{var e=shaka.net.DataUriPlugin.parseRaw(a);return shaka.util.AbortableOperation.completed({uri:a,originalUri:a,data:e.data,headers:{"content-type":e.contentType}})}catch(f){return shaka.util.AbortableOperation.failed(f)}};
|
|
1552
|
+
b,c,e)};shaka.hls.ManifestTextParser.MEDIA_PLAYLIST_TAGS="EXT-X-TARGETDURATION EXT-X-MEDIA-SEQUENCE EXT-X-DISCONTINUITY-SEQUENCE EXT-X-PLAYLIST-TYPE EXT-X-I-FRAMES-ONLY EXT-X-ENDLIST EXT-X-SERVER-CONTROL EXT-X-SKIP EXT-X-PART-INF".split(" ");shaka.hls.ManifestTextParser.SEGMENT_TAGS="EXTINF EXT-X-BYTERANGE EXT-X-DISCONTINUITY EXT-X-PROGRAM-DATE-TIME EXT-X-KEY EXT-X-DATERANGE EXT-X-MAP".split(" ");shaka.net.DataUriPlugin=function(){};shaka.net.DataUriPlugin.parse=function(a,b,c,d){try{var e=shaka.net.DataUriPlugin.parseRaw(a);return shaka.util.AbortableOperation.completed({uri:a,originalUri:a,data:e.data,headers:{"content-type":e.contentType}})}catch(f){return shaka.util.AbortableOperation.failed(f)}};
|
|
1551
1553
|
shaka.net.DataUriPlugin.parseRaw=function(a){var b=a.split(":");if(2>b.length||"data"!=b[0])throw shaka.log.error("Bad data URI, failed to parse scheme"),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.NETWORK,shaka.util.Error.Code.MALFORMED_DATA_URI,a);b=b.slice(1).join(":").split(",");if(2>b.length)throw shaka.log.error("Bad data URI, failed to extract encoding and MIME type"),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.NETWORK,
|
|
1552
1554
|
shaka.util.Error.Code.MALFORMED_DATA_URI,a);var c=b[0];a=window.decodeURIComponent(b.slice(1).join(","));b=c.split(";");c=b[0];var d=!1;1<b.length&&"base64"==b[b.length-1]&&(d=!0,b.pop());return{data:d?shaka.util.Uint8ArrayUtils.fromBase64(a):shaka.util.StringUtils.toUTF8(a),contentType:c}};goog.exportSymbol("shaka.net.DataUriPlugin",shaka.net.DataUriPlugin);goog.exportProperty(shaka.net.DataUriPlugin,"parse",shaka.net.DataUriPlugin.parse);shaka.net.NetworkingEngine.registerScheme("data",shaka.net.DataUriPlugin.parse);shaka.hls.HlsParser=function(){var a=this;this.config_=this.playerInterface_=null;this.globalId_=1;this.globalVariables_=new Map;this.groupIdToStreamInfosMap_=new Map;this.variantUriSet_=new Set;this.uriToStreamInfosMap_=new Map;this.presentationTimeline_=null;this.masterPlaylistUri_="";this.manifestTextParser_=new shaka.hls.ManifestTextParser;this.updatePlaylistDelay_=0;this.streamsSynced_=!1;this.minSequenceNumber_=null;this.lowestSyncTime_=Infinity;this.updatePlaylistTimer_=new shaka.util.Timer(function(){a.onUpdate_()});
|
|
1553
1555
|
this.presentationType_=shaka.hls.HlsParser.PresentationType_.VOD;this.manifest_=null;this.maxTargetDuration_=0;this.minTargetDuration_=Infinity;this.lowLatencyPresentationDelay_=this.partialTargetDuration_=0;this.operationManager_=new shaka.util.OperationManager;this.segmentsToNotifyByStream_=[];this.groupIdToClosedCaptionsMap_=new Map;this.groupIdToCodecsMap_=new Map;this.mapTagToInitSegmentRefMap_=new Map;this.lowLatencyMode_=!1};
|
|
@@ -1622,9 +1624,9 @@ shaka.hls.HlsParser.prototype.createInitSegmentReference_=function(a,b){var c=0,
|
|
|
1622
1624
|
shaka.hls.HlsParser.prototype.createSegmentReference_=function(a,b,c,d,e,f,g,h){var k=c.tags,l=this.variableSubstitution_(c.absoluteUri,e),m=shaka.hls.Utils.getFirstTagWithName(k,"EXTINF"),n=0;e=0;var p=null;c.partialSegments.length&&!this.lowLatencyMode_&&shaka.log.alwaysWarn("Low-latency HLS live stream detected, but low-latency streaming mode is not enabled in Shaka Player. Set streaming.lowLatencyMode configuration to true, and see https://bit.ly/3clctcj for details.");var q=null;if(!this.config_.hls.ignoreManifestProgramDateTime){var r=
|
|
1623
1625
|
shaka.hls.Utils.getFirstTagWithName(k,"EXT-X-PROGRAM-DATE-TIME");r&&r.value&&(q=shaka.util.XmlUtils.parseDate(r.value),goog.asserts.assert(null!=q,"EXT-X-PROGRAM-DATE-TIME format not valid"))}r=shaka.media.SegmentReference.Status.AVAILABLE;shaka.hls.Utils.getFirstTagWithName(k,"EXT-X-GAP")&&(r=shaka.media.SegmentReference.Status.MISSING);if(!m){if(0==c.partialSegments.length)throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.HLS_REQUIRED_TAG_MISSING,
|
|
1624
1626
|
"EXTINF");if(!this.lowLatencyMode_)return null}var t=[];if(this.lowLatencyMode_){n={};for(var v=0;v<c.partialSegments.length;n={$jscomp$loop$prop$pAbsoluteUri$662:n.$jscomp$loop$prop$pAbsoluteUri$662},v++){var u=c.partialSegments[v],x=0==v?b:t[t.length-1],w=0==v?d:x.endTime,y=Number(u.getAttributeValue("DURATION"))||this.partialTargetDuration_;if(y){y=w+y;var A=0,z=null;"EXT-X-PRELOAD-HINT"==u.name?A=(A=u.getAttributeValue("BYTERANGE-START"))?Number(A):0:(A=u.getAttributeValue("BYTERANGE"),z=$jscomp.makeIterator(this.parseByteRange_(x,
|
|
1625
|
-
A)),A=z.next().value,z=z.next().value);if(x=u.getAttributeValue("URI"))n.$jscomp$loop$prop$pAbsoluteUri$662=shaka.hls.Utils.constructAbsoluteUri(f,x),x=shaka.media.SegmentReference.Status.AVAILABLE,"YES"==u.getAttributeValue("GAP")&&(x=shaka.media.SegmentReference.Status.MISSING),
|
|
1626
|
-
1].endTime;(c=shaka.hls.Utils.getFirstTagWithName(k,"EXT-X-BYTERANGE"))?(p=$jscomp.makeIterator(this.parseByteRange_(b,c.value)),e=p.next().value,p=p.next().value):t.length&&(e=t[0].startByte,p=t[t.length-1].endByte);b="";c=null;g==shaka.util.ManifestParserUtils.ContentType.IMAGE&&(b="1x1",g=shaka.hls.Utils.getFirstTagWithName(k,"EXT-X-TILES"))&&(b=g.getRequiredAttrValue("LAYOUT"),(g=g.getAttributeValue("DURATION"))&&(c=Number(g)));return new shaka.media.SegmentReference(d,
|
|
1627
|
-
[l]:[]},e,p,a,0,0,Infinity,t,b,c,q,r,h)};shaka.hls.HlsParser.prototype.parseByteRange_=function(a,b){var c=0,d=null;b&&(c=b.split("@"),b=Number(c[0]),c[1]?c=Number(c[1]):(goog.asserts.assert(a,"Cannot refer back to previous HLS segment!"),c=a.endByte+1),d=c+b-1);return[c,d]};
|
|
1627
|
+
A)),A=z.next().value,z=z.next().value);if(x=u.getAttributeValue("URI"))n.$jscomp$loop$prop$pAbsoluteUri$662=shaka.hls.Utils.constructAbsoluteUri(f,x),x=shaka.media.SegmentReference.Status.AVAILABLE,"YES"==u.getAttributeValue("GAP")&&(x=shaka.media.SegmentReference.Status.MISSING),w=new shaka.media.SegmentReference(w,y,function(B){return function(){return[B.$jscomp$loop$prop$pAbsoluteUri$662]}}(n),A,z,a,0,0,Infinity,[],"",null,null,x),"EXT-X-PRELOAD-HINT"==u.name&&w.markAsPreload(),t.push(w)}}}m?(c=
|
|
1628
|
+
m.value.split(","),n=d+Number(c[0])):n=t[t.length-1].endTime;(c=shaka.hls.Utils.getFirstTagWithName(k,"EXT-X-BYTERANGE"))?(p=$jscomp.makeIterator(this.parseByteRange_(b,c.value)),e=p.next().value,p=p.next().value):t.length&&(e=t[0].startByte,p=t[t.length-1].endByte);b="";c=null;g==shaka.util.ManifestParserUtils.ContentType.IMAGE&&(b="1x1",g=shaka.hls.Utils.getFirstTagWithName(k,"EXT-X-TILES"))&&(b=g.getRequiredAttrValue("LAYOUT"),(g=g.getAttributeValue("DURATION"))&&(c=Number(g)));return new shaka.media.SegmentReference(d,
|
|
1629
|
+
n,function(){return l.length?[l]:[]},e,p,a,0,0,Infinity,t,b,c,q,r,h)};shaka.hls.HlsParser.prototype.parseByteRange_=function(a,b){var c=0,d=null;b&&(c=b.split("@"),b=Number(c[0]),c[1]?c=Number(c[1]):(goog.asserts.assert(a,"Cannot refer back to previous HLS segment!"),c=a.endByte+1),d=c+b-1);return[c,d]};
|
|
1628
1630
|
shaka.hls.HlsParser.prototype.notifySegments_=function(){if(this.presentationTimeline_){for(var a=$jscomp.makeIterator(this.segmentsToNotifyByStream_),b=a.next();!b.done;b=a.next())this.presentationTimeline_.notifySegments(b.value);this.segmentsToNotifyByStream_=[]}};
|
|
1629
1631
|
shaka.hls.HlsParser.prototype.createSegments_=function(a,b,c,d,e,f,g){a=b.segments;goog.asserts.assert(a.length,"Playlist should have segments!");d=void 0;g=shaka.hls.Utils.getFirstTagWithNameAsNumber(b.tags,"EXT-X-DISCONTINUITY-SEQUENCE",0);var h=shaka.hls.Utils.getFirstTagWithNameAsNumber(b.tags,"EXT-X-MEDIA-SEQUENCE",0),k=shaka.hls.Utils.getFirstTagWithName(b.tags,"EXT-X-SKIP");k=k?Number(k.getAttributeValue("SKIPPED-SEGMENTS")):0;var l=h+k,m=0;this.isLive_()&&e.has(l)&&(m=e.get(l));for(var n=
|
|
1630
1632
|
[],p=null,q=0;q<a.length;q++){var r=a[q],t=0==q?m:p.endTime;l=h+k+q;shaka.hls.Utils.getFirstTagWithName(r.tags,"EXT-X-DISCONTINUITY")&&g++;var v=$jscomp.makeIterator(r.tags);for(var u=v.next();!u.done;u=v.next())u=u.value,"EXT-X-KEY"==u.name&&(d="AES-128"==u.getRequiredAttrValue("METHOD")?this.parseAES128DrmTag_(u,b):void 0);e.set(l,t);v=this.getInitSegmentReference_(b.absoluteUri,r.tags,f);!this.lowLatencyMode_&&this.playerInterface_.isAutoLowLatencyMode()&&(this.playerInterface_.enableLowLatencyMode(),
|
|
@@ -1632,7 +1634,7 @@ this.lowLatencyMode_=this.playerInterface_.isLowLatencyMode());if(p=r=this.creat
|
|
|
1632
1634
|
$jscomp$loop$prop$reference$557$667:c.$jscomp$loop$prop$reference$557$667,$jscomp$loop$prop$backwardAdd$668:c.$jscomp$loop$prop$backwardAdd$668},e++)if(c.$jscomp$loop$prop$reference$557$667=n[e],null==c.$jscomp$loop$prop$reference$557$667.syncTime)for(c.$jscomp$loop$prop$forwardAdd$665=0,c.$jscomp$loop$prop$forwardI$664=e,f=function(x){return function(){var w=n[x.$jscomp$loop$prop$forwardI$664];if(w){if(null!=w.syncTime)return w.syncTime+x.$jscomp$loop$prop$forwardAdd$665;x.$jscomp$loop$prop$forwardAdd$665-=
|
|
1633
1635
|
w.endTime-w.startTime;x.$jscomp$loop$prop$forwardI$664+=1}return null}}(c),c.$jscomp$loop$prop$backwardAdd$668=0,c.$jscomp$loop$prop$backwardI$666=e,a=function(x){return function(){var w=n[x.$jscomp$loop$prop$backwardI$666];if(w){w!=x.$jscomp$loop$prop$reference$557$667&&(x.$jscomp$loop$prop$backwardAdd$668+=w.endTime-w.startTime);if(null!=w.syncTime)return w.syncTime+x.$jscomp$loop$prop$backwardAdd$668;--x.$jscomp$loop$prop$backwardI$666}return null}}(c);null==c.$jscomp$loop$prop$reference$557$667.syncTime;)c.$jscomp$loop$prop$reference$557$667.syncTime=
|
|
1634
1636
|
a(),null==c.$jscomp$loop$prop$reference$557$667.syncTime&&(c.$jscomp$loop$prop$reference$557$667.syncTime=f());if(b)for(c=$jscomp.makeIterator(n),e=c.next();!e.done;e=c.next())for(f=e.value,e=f.syncTime,f=$jscomp.makeIterator(f.partialReferences),a=f.next();!a.done;a=f.next())a=a.value,a.syncTime=e,e+=a.endTime-a.startTime;c=this.lowestSyncTime_;if(b&&Infinity!=c)for(b=$jscomp.makeIterator(n),e=b.next();!e.done;e=b.next())e.value.syncAgainst(c);return n};
|
|
1635
|
-
shaka.hls.HlsParser.prototype.variableSubstitution_=function(a,b){a=String(a).replace(/%7B/g,"{").replace(/%7D/g,"}");var c=a.match(/{\$\w*}/g);if(c){c=$jscomp.makeIterator(c);for(var d=c.next();!d.done;d=c.next()){d=d.value;var e=d.slice(2,d.length-1),f=b.get(e);if(f)a=a.replace(d,f);else throw shaka.log.error("A variable has been found that is not declared",e),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.HLS_VARIABLE_NOT_FOUND,
|
|
1637
|
+
shaka.hls.HlsParser.prototype.variableSubstitution_=function(a,b){if(!b.size)return a;a=String(a).replace(/%7B/g,"{").replace(/%7D/g,"}");var c=a.match(/{\$\w*}/g);if(c){c=$jscomp.makeIterator(c);for(var d=c.next();!d.done;d=c.next()){d=d.value;var e=d.slice(2,d.length-1),f=b.get(e);if(f)a=a.replace(d,f);else throw shaka.log.error("A variable has been found that is not declared",e),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.HLS_VARIABLE_NOT_FOUND,
|
|
1636
1638
|
e);}}return a};
|
|
1637
1639
|
shaka.hls.HlsParser.prototype.guessMimeType_=function(a,b,c,d){var e=this,f,g,h,k,l,m,n,p,q,r,t,v,u;return $jscomp.asyncExecutePromiseGeneratorProgram(function(x){if(1==x.nextAddress){f=shaka.hls.HlsParser;g=shaka.util.ManifestParserUtils.ContentType;h=shaka.net.NetworkingEngine.RequestType.SEGMENT;goog.asserts.assert(c.segments.length,"Playlist should have segments!");k=Math.trunc((c.segments.length-1)/2);l=e.variableSubstitution_(c.segments[k].absoluteUri,d);m=new goog.Uri(l);n=m.getPath().split(".").pop();p=
|
|
1638
1640
|
f.EXTENSION_MAP_BY_CONTENT_TYPE_[a];if((q=p[n])||(q=f.RAW_FORMATS_TO_MIME_TYPES_[n]))return x.return(q);if(a==g.TEXT){if("vtt"==b||"wvtt"==b)return x.return("text/vtt");if(b&&""!==b)return x.return("application/mp4")}if(a==g.IMAGE&&(!b||"jpeg"==b))return x.return("image/jpeg");r=shaka.net.NetworkingEngine.makeRequest([l],e.config_.retryParameters);r.method="HEAD";return x.yield(e.makeNetworkRequest_(r,h),2)}t=x.yieldResult;v=t.headers["content-type"];if(!v){if(a==g.TEXT)return x.return("text/vtt");
|