shaka-player 4.6.16 → 4.6.17
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/CHANGELOG.md +14 -0
- package/dist/locales.js +32 -32
- package/dist/shaka-player.compiled.debug.js +10 -11
- package/dist/shaka-player.compiled.debug.map +3 -3
- package/dist/shaka-player.compiled.js +202 -201
- package/dist/shaka-player.compiled.map +3 -3
- package/dist/shaka-player.ui.debug.js +12 -14
- package/dist/shaka-player.ui.debug.map +3 -3
- package/dist/shaka-player.ui.js +229 -228
- package/dist/shaka-player.ui.map +3 -3
- package/docs/tutorials/faq.md +13 -0
- package/docs/tutorials/offline.md +3 -0
- package/lib/media/playhead.js +3 -3
- package/lib/media/streaming_engine.js +1 -13
- package/lib/player.js +7 -3
- package/lib/util/stream_utils.js +2 -3
- package/package.json +1 -1
- package/test/media/playhead_unit.js +1 -1
|
@@ -279,9 +279,8 @@ new Map([["AD_DURATION","\uad11\uace0 \uae30\uac04"],["AD_PROGRESS","\uad11\uace
|
|
|
279
279
|
"\u5ee3\u544a [AD_ON]/[NUM_ADS]"],["AD_TIME","\u5ee3\u544a\uff1a[AD_TIME]"],["AUTO_QUALITY","\u81ea\u52d5"],["BACK","\u8fd4\u56de"],["CAPTIONS","\u5b57\u5e55"],["CAST","\u6295\u653e..."],["ENTER_LOOP_MODE","\u5faa\u74b0\u64ad\u653e\u76ee\u524d\u7684\u5f71\u7247"],["ENTER_PICTURE_IN_PICTURE","\u9032\u5165\u5b50\u6bcd\u756b\u9762"],["EXIT_FULL_SCREEN","\u9000\u51fa\u5168\u87a2\u5e55\u6a21\u5f0f"],["EXIT_LOOP_MODE","\u505c\u6b62\u5faa\u74b0\u64ad\u653e\u76ee\u524d\u7684\u5f71\u7247"],["EXIT_PICTURE_IN_PICTURE",
|
|
280
280
|
"\u96e2\u958b\u5b50\u6bcd\u756b\u9762"],["FAST_FORWARD","\u5feb\u8f49"],["FULL_SCREEN","\u5168\u87a2\u5e55"],["LANGUAGE","\u8a9e\u8a00"],["LIVE","\u76f4\u64ad"],["LOOP","\u5faa\u74b0\u64ad\u653e"],["MORE_SETTINGS","\u986f\u793a\u66f4\u591a\u8a2d\u5b9a"],["MULTIPLE_LANGUAGES","\u591a\u7a2e\u8a9e\u8a00"],["MUTE","\u975c\u97f3"],["NOT_APPLICABLE","\u4e0d\u9069\u7528"],["OFF","\u95dc\u9589"],["ON","\u958b\u555f"],["PAUSE","\u66ab\u505c"],["PICTURE_IN_PICTURE","\u5b50\u6bcd\u756b\u9762"],["PLAY","\u64ad\u653e"],
|
|
281
281
|
["PLAYBACK_RATE","\u64ad\u653e\u901f\u5ea6"],["RESOLUTION","\u89e3\u6790\u5ea6"],["REWIND","\u5012\u8f49"],["SEEK","\u641c\u5c0b"],["SKIP_AD","\u7565\u904e\u5ee3\u544a"],["SKIP_TO_LIVE","\u8df3\u81f3\u5f53\u524d\u76f4\u64ad"],["UNDETERMINED_LANGUAGE","\u4e0d\u660e"],["UNMUTE","\u53d6\u6d88\u975c\u97f3"],["UNRECOGNIZED_LANGUAGE","\u7121\u6cd5\u8fa8\u8b58"],["VOLUME","\u97f3\u91cf"]]))};
|
|
282
|
-
shaka.ui.Locales.Ids={
|
|
283
|
-
|
|
284
|
-
SURROUND:"SURROUND"};shaka.abr={};shaka.abr.Ewma=function(a){goog.asserts.assert(0<a,"expected halfLife to be positive");this.alpha_=Math.exp(Math.log(.5)/a);this.totalWeight_=this.estimate_=0};shaka.abr.Ewma.prototype.updateAlpha=function(a){goog.asserts.assert(0<a,"expected halfLife to be positive");this.alpha_=Math.exp(Math.log(.5)/a)};shaka.abr.Ewma.prototype.sample=function(a,b){var c=Math.pow(this.alpha_,a);b=b*(1-c)+c*this.estimate_;isNaN(b)||(this.estimate_=b,this.totalWeight_+=a)};
|
|
282
|
+
shaka.ui.Locales.Ids={FAST_FORWARD:"FAST_FORWARD",REWIND:"REWIND",PAUSE:"PAUSE",PICTURE_IN_PICTURE:"PICTURE_IN_PICTURE",FULL_SCREEN:"FULL_SCREEN",EXIT_LOOP_MODE:"EXIT_LOOP_MODE",MUTE:"MUTE",MULTIPLE_LANGUAGES:"MULTIPLE_LANGUAGES",NOT_APPLICABLE:"NOT_APPLICABLE",OFF:"OFF",RESOLUTION:"RESOLUTION",AD_DURATION:"AD_DURATION",AD_TIME:"AD_TIME",CAST:"CAST",PLAY:"PLAY",AIRPLAY:"AIRPLAY",SURROUND:"SURROUND",UNDETERMINED_LANGUAGE:"UNDETERMINED_LANGUAGE",STATISTICS:"STATISTICS",LOOP:"LOOP",VOLUME:"VOLUME",PLAYBACK_RATE:"PLAYBACK_RATE",
|
|
283
|
+
CAPTIONS:"CAPTIONS",SEEK:"SEEK",AD_PROGRESS:"AD_PROGRESS",QUALITY:"QUALITY",MORE_SETTINGS:"MORE_SETTINGS",EXIT_PICTURE_IN_PICTURE:"EXIT_PICTURE_IN_PICTURE",ENTER_LOOP_MODE:"ENTER_LOOP_MODE",AUTO_QUALITY:"AUTO_QUALITY",EXIT_FULL_SCREEN:"EXIT_FULL_SCREEN",UNMUTE:"UNMUTE",SUBTITLE_FORCED:"SUBTITLE_FORCED",LANGUAGE:"LANGUAGE",ENTER_PICTURE_IN_PICTURE:"ENTER_PICTURE_IN_PICTURE",SKIP_TO_LIVE:"SKIP_TO_LIVE",LIVE:"LIVE",ON:"ON",BACK:"BACK",REPLAY:"REPLAY",UNRECOGNIZED_LANGUAGE:"UNRECOGNIZED_LANGUAGE",SKIP_AD:"SKIP_AD"};shaka.abr={};shaka.abr.Ewma=function(a){goog.asserts.assert(0<a,"expected halfLife to be positive");this.alpha_=Math.exp(Math.log(.5)/a);this.totalWeight_=this.estimate_=0};shaka.abr.Ewma.prototype.updateAlpha=function(a){goog.asserts.assert(0<a,"expected halfLife to be positive");this.alpha_=Math.exp(Math.log(.5)/a)};shaka.abr.Ewma.prototype.sample=function(a,b){var c=Math.pow(this.alpha_,a);b=b*(1-c)+c*this.estimate_;isNaN(b)||(this.estimate_=b,this.totalWeight_+=a)};
|
|
285
284
|
shaka.abr.Ewma.prototype.getEstimate=function(){return this.estimate_/(1-Math.pow(this.alpha_,this.totalWeight_))};shaka.abr.EwmaBandwidthEstimator=function(){this.fast_=new shaka.abr.Ewma(2);this.slow_=new shaka.abr.Ewma(5);this.bytesSampled_=0;this.minTotalBytes_=128E3;this.minBytes_=16E3};shaka.abr.EwmaBandwidthEstimator.prototype.configure=function(a){this.minTotalBytes_=a.minTotalBytes;this.minBytes_=a.minBytes;this.fast_.updateAlpha(a.fastHalfLife);this.slow_.updateAlpha(a.slowHalfLife)};
|
|
286
285
|
shaka.abr.EwmaBandwidthEstimator.prototype.sample=function(a,b){if(!(b<this.minBytes_)){var c=8E3*b/a;a/=1E3;this.bytesSampled_+=b;this.fast_.sample(a,c);this.slow_.sample(a,c)}};shaka.abr.EwmaBandwidthEstimator.prototype.getBandwidthEstimate=function(a){return this.bytesSampled_<this.minTotalBytes_?a:Math.min(this.fast_.getEstimate(),this.slow_.getEstimate())};shaka.abr.EwmaBandwidthEstimator.prototype.hasGoodEstimate=function(){return this.bytesSampled_>=this.minTotalBytes_};shaka.util.EventManager=function(){this.bindingMap_=new shaka.util.MultiMap};shaka.util.EventManager.prototype.release=function(){this.removeAll();this.bindingMap_=null};shaka.util.EventManager.prototype.listen=function(a,b,c,d){this.bindingMap_&&(a=new shaka.util.EventManager.Binding_(a,b,c,d),this.bindingMap_.push(b,a))};shaka.util.EventManager.prototype.listenOnce=function(a,b,c,d){var e=this,f=function(g){e.unlisten(a,b,f);c(g)};this.listen(a,b,f,d)};
|
|
287
286
|
shaka.util.EventManager.prototype.unlisten=function(a,b,c){if(this.bindingMap_){var d=this.bindingMap_.get(b)||[];d=$jscomp.makeIterator(d);for(var e=d.next();!e.done;e=d.next())e=e.value,e.target!=a||c!=e.listener&&c||(e.unlisten(),this.bindingMap_.remove(b,e))}};shaka.util.EventManager.prototype.removeAll=function(){if(this.bindingMap_){var a=this.bindingMap_.getAll();a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next())b.value.unlisten();this.bindingMap_.clear()}};
|
|
@@ -394,8 +393,7 @@ shaka.util.StreamUtils.textStreamToTrack=function(a){return{id:a.id,active:!1,ty
|
|
|
394
393
|
audioSamplingRate:null,spatialAudio:!1,tilesLayout:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:a.originalId,originalImageId:null,accessibilityPurpose:a.accessibilityPurpose,originalLanguage:a.originalLanguage}};
|
|
395
394
|
shaka.util.StreamUtils.imageStreamToTrack=function(a){var b=shaka.util.ManifestParserUtils.ContentType,c=a.width||null,d=a.height||null,e=null;a.segmentIndex&&(e=a.segmentIndex.get(0));var f=a.tilesLayout;e&&(f=e.getTilesLayout()||f);f&&null!=c&&(c/=Number(f.split("x")[0]));f&&null!=d&&(d/=Number(f.split("x")[1]));return{id:a.id,active:!1,type:b.IMAGE,bandwidth:a.bandwidth||0,language:"",label:null,kind:null,width:c,height:d,frameRate:null,pixelAspectRatio:null,hdr:null,videoLayout:null,mimeType:a.mimeType,
|
|
396
395
|
audioMimeType:null,videoMimeType:null,codecs:a.codecs||null,audioCodec:null,videoCodec:null,primary:!1,roles:[],audioRoles:null,forced:!1,videoId:null,audioId:null,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,tilesLayout:f||null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null,originalImageId:a.originalId,accessibilityPurpose:null,originalLanguage:null}};
|
|
397
|
-
shaka.util.StreamUtils.html5TrackId=function(a){a.__shaka_id||(a.__shaka_id=shaka.util.StreamUtils.nextTrackId_++);return a.__shaka_id};
|
|
398
|
-
shaka.util.StreamUtils.html5TextTrackToTrack=function(a){var b=shaka.util.MimeUtils.CEA608_CLOSED_CAPTION_MIMETYPE,c=shaka.util.StreamUtils.html5TrackToGenericShakaTrack_(a);c.active="disabled"!=a.mode;c.type="text";c.originalTextId=a.id;"captions"==a.kind&&(c.mimeType=b);"subtitles"==a.kind&&(c.mimeType="text/vtt");a.kind&&(c.roles=[a.kind]);"forced"==a.kind&&(c.forced=!0);return c};
|
|
396
|
+
shaka.util.StreamUtils.html5TrackId=function(a){a.__shaka_id||(a.__shaka_id=shaka.util.StreamUtils.nextTrackId_++);return a.__shaka_id};shaka.util.StreamUtils.html5TextTrackToTrack=function(a){var b=shaka.util.StreamUtils.html5TrackToGenericShakaTrack_(a);b.active="disabled"!=a.mode;b.type="text";b.originalTextId=a.id;"captions"==a.kind&&(b.mimeType="unknown");"subtitles"==a.kind&&(b.mimeType="text/vtt");a.kind&&(b.roles=[a.kind]);"forced"==a.kind&&(b.forced=!0);return b};
|
|
399
397
|
shaka.util.StreamUtils.html5AudioTrackToTrack=function(a){var b=shaka.util.StreamUtils.html5TrackToGenericShakaTrack_(a);b.active=a.enabled;b.type="variant";b.originalAudioId=a.id;"main"==a.kind&&(b.primary=!0);a.kind&&(b.roles=[a.kind],b.audioRoles=[a.kind],b.label=a.label);return b};
|
|
400
398
|
shaka.util.StreamUtils.html5TrackToGenericShakaTrack_=function(a){var b=a.language;return{id:shaka.util.StreamUtils.html5TrackId(a),active:!1,type:"",bandwidth:0,language:shaka.util.LanguageUtils.normalize(b||"und"),label:a.label,kind:a.kind,width:null,height:null,frameRate:null,pixelAspectRatio:null,hdr:null,videoLayout:null,mimeType:null,audioMimeType:null,videoMimeType:null,codecs:null,audioCodec:null,videoCodec:null,primary:!1,roles:[],forced:!1,audioRoles:null,videoId:null,audioId:null,channelsCount:null,
|
|
401
399
|
audioSamplingRate:null,spatialAudio:!1,tilesLayout:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null,originalImageId:null,accessibilityPurpose:null,originalLanguage:b}};shaka.util.StreamUtils.isPlayable=function(a){return a.allowedByApplication&&a.allowedByKeySystem&&0==a.disabledUntilTime};shaka.util.StreamUtils.getPlayableVariants=function(a){return a.filter(function(b){return shaka.util.StreamUtils.isPlayable(b)})};
|
|
@@ -856,7 +854,7 @@ function(){return g.getStartTime_(d)});this.checkWindowTimer_=new shaka.util.Tim
|
|
|
856
854
|
shaka.media.MediaSourcePlayhead.prototype.release=function(){this.videoWrapper_&&(this.videoWrapper_.release(),this.videoWrapper_=null);this.gapController_&&(this.gapController_.release(),this.gapController_=null);this.checkWindowTimer_&&(this.checkWindowTimer_.stop(),this.checkWindowTimer_=null);this.mediaElement_=this.videoWrapper_=this.timeline_=this.config_=null;this.onSeek_=function(){}};shaka.media.MediaSourcePlayhead.prototype.setStartTime=function(a){this.videoWrapper_.setTime(a)};
|
|
857
855
|
shaka.media.MediaSourcePlayhead.prototype.getTime=function(){var a=this.videoWrapper_.getTime();return 0<this.mediaElement_.readyState&&!this.mediaElement_.paused?this.clampTime_(a):a};shaka.media.MediaSourcePlayhead.prototype.getStallsDetected=function(){return this.stallDetector_?this.stallDetector_.getStallsDetected():0};shaka.media.MediaSourcePlayhead.prototype.getGapsJumped=function(){return this.gapController_.getGapsJumped()};
|
|
858
856
|
shaka.media.MediaSourcePlayhead.prototype.getStartTime_=function(a){null==a?a=Infinity>this.timeline_.getDuration()?this.timeline_.getSeekRangeStart():this.timeline_.getSeekRangeEnd():0>a&&(a=this.timeline_.getSeekRangeEnd()+a);return this.clampSeekToDuration_(this.clampTime_(a))};shaka.media.MediaSourcePlayhead.prototype.notifyOfBufferingChange=function(){this.gapController_.onSegmentAppended()};
|
|
859
|
-
shaka.media.MediaSourcePlayhead.prototype.onPollWindow_=function(){if(0!=this.mediaElement_.readyState&&!this.mediaElement_.paused){var a=this.videoWrapper_.getTime(),b=this.timeline_.getSeekRangeStart(),c=this.timeline_.getSeekRangeEnd();c-b<this.minSeekRange_&&(b=c-this.minSeekRange_);a<b
|
|
857
|
+
shaka.media.MediaSourcePlayhead.prototype.onPollWindow_=function(){if(0!=this.mediaElement_.readyState&&!this.mediaElement_.paused){var a=this.videoWrapper_.getTime(),b=this.timeline_.getSeekRangeStart(),c=this.timeline_.getSeekRangeEnd();c-b<this.minSeekRange_&&(b=c-this.minSeekRange_);if(a<b||a>c)b=this.reposition_(a),shaka.log.info("Jumping by "+(b-a)+" seconds to catch up with the seek range."),this.mediaElement_.currentTime=b}};shaka.media.MediaSourcePlayhead.prototype.onStarted_=function(a){this.gapController_.onStarted(a)};
|
|
860
858
|
shaka.media.MediaSourcePlayhead.prototype.onSeeking_=function(){this.gapController_.onSeeking();var a=this.videoWrapper_.getTime(),b=this.reposition_(a);if(Math.abs(b-a)>shaka.media.GapJumpingController.BROWSER_GAP_TOLERANCE){var c=Date.now()/1E3;if(!this.lastCorrectiveSeek_||this.lastCorrectiveSeek_<c-1){this.lastCorrectiveSeek_=c;this.videoWrapper_.setTime(b);return}}shaka.log.v1("Seek to "+a);this.onSeek_()};
|
|
861
859
|
shaka.media.MediaSourcePlayhead.prototype.clampSeekToDuration_=function(a){var b=this.timeline_.getDuration();return a>=b?(goog.asserts.assert(0<=this.config_.durationBackoff,"Duration backoff must be non-negative!"),b-this.config_.durationBackoff):a};
|
|
862
860
|
shaka.media.MediaSourcePlayhead.prototype.reposition_=function(a){goog.asserts.assert(this.config_,"Cannot reposition playhead when it has beeen destroyed");var b=Math.max(this.minBufferTime_,this.config_.rebufferingGoal),c=this.config_.safeSeekOffset,d=this.timeline_.getSeekRangeStart(),e=this.timeline_.getSeekRangeEnd(),f=this.timeline_.getDuration();e-d<this.minSeekRange_&&(d=e-this.minSeekRange_);var g=this.timeline_.getSafeSeekRangeStart(b),h=this.timeline_.getSafeSeekRangeStart(c);b=this.timeline_.getSafeSeekRangeStart(b+
|
|
@@ -942,8 +940,8 @@ a.updateTimer&&this.scheduleUpdate_(a,0)):(shaka.log.debug(c,"clear: handling ri
|
|
|
942
940
|
shaka.media.StreamingEngine.prototype.initStreams_=function(){var a=this,b,c,d,e,f,g,h,k,l;return $jscomp.asyncExecutePromiseGeneratorProgram(function(m){if(1==m.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);
|
|
943
941
|
c=new Map;d=new Set;a.currentVariant_.audio&&(c.set(b.AUDIO,a.currentVariant_.audio),d.add(a.currentVariant_.audio));a.currentVariant_.video&&(c.set(b.VIDEO,a.currentVariant_.video),d.add(a.currentVariant_.video));a.currentTextStream_&&(c.set(b.TEXT,a.currentTextStream_),d.add(a.currentTextStream_));e=a.playerInterface_.mediaSourceEngine;return m.yield(e.init(c,a.manifest_.sequenceMode,a.manifest_.type,a.manifest_.ignoreManifestTimestampsInSegmentsMode),2)}a.destroyer_.ensureNotDestroyed();a.updateDuration();
|
|
944
942
|
f=$jscomp.makeIterator(c.keys());for(g=f.next();!g.done;g=f.next())h=g.value,k=c.get(h),a.mediaStates_.has(h)||(l=a.createMediaState_(k),a.mediaStates_.set(h,l),a.scheduleUpdate_(l,0));m.jumpToEnd()})};
|
|
945
|
-
shaka.media.StreamingEngine.prototype.createMediaState_=function(a){return{stream:a,type:a.type,segmentIterator:null,segmentPrefetch:this.createSegmentPrefetch_(a),lastSegmentReference:null,lastInitSegmentReference:null,lastTimestampOffset:null,lastAppendWindowStart:null,lastAppendWindowEnd:null,restoreStreamAfterTrickPlay:null,endOfStream:!1,performingUpdate:!1,updateTimer:null,waitingToClearBuffer:!1,clearBufferSafeMargin:0,waitingToFlushBuffer:!1,clearingBuffer:!1,seeked:!0,
|
|
946
|
-
|
|
943
|
+
shaka.media.StreamingEngine.prototype.createMediaState_=function(a){return{stream:a,type:a.type,segmentIterator:null,segmentPrefetch:this.createSegmentPrefetch_(a),lastSegmentReference:null,lastInitSegmentReference:null,lastTimestampOffset:null,lastAppendWindowStart:null,lastAppendWindowEnd:null,restoreStreamAfterTrickPlay:null,endOfStream:!1,performingUpdate:!1,updateTimer:null,waitingToClearBuffer:!1,clearBufferSafeMargin:0,waitingToFlushBuffer:!1,clearingBuffer:!1,seeked:!0,recovering:!1,hasError:!1,
|
|
944
|
+
operation:null}};shaka.media.StreamingEngine.prototype.createSegmentPrefetch_=function(a){var b=this;return a.type!==shaka.util.ManifestParserUtils.ContentType.VIDEO&&a.type!==shaka.util.ManifestParserUtils.ContentType.AUDIO?null:0<this.config_.segmentPrefetchLimit?new shaka.media.SegmentPrefetch(this.config_.segmentPrefetchLimit,a,function(c,d,e){return b.dispatchFetch_(c,d,e)}):null};
|
|
947
945
|
shaka.media.StreamingEngine.prototype.updateDuration=function(){var a=this.manifest_.presentationTimeline.getDuration();Infinity>a?this.playerInterface_.mediaSourceEngine.setDuration(a):this.playerInterface_.mediaSourceEngine.setDuration(Math.pow(2,32))};
|
|
948
946
|
shaka.media.StreamingEngine.prototype.onUpdate_=function(a){var b=this,c,d,e,f,g,h;return $jscomp.asyncExecutePromiseGeneratorProgram(function(k){switch(k.nextAddress){case 1:b.destroyer_.ensureNotDestroyed();c=shaka.media.StreamingEngine.logPrefix_(a);goog.asserts.assert(!a.performingUpdate&&null!=a.updateTimer,c+" unexpected call to onUpdate_()");if(a.performingUpdate||null==a.updateTimer)return k.return();goog.asserts.assert(!a.clearingBuffer,c+" onUpdate_() should not be called when clearing the buffer");
|
|
949
947
|
if(a.clearingBuffer)return k.return();a.updateTimer=null;if(!a.waitingToClearBuffer){k.jumpTo(2);break}shaka.log.debug(c,"skipping update and clearing the buffer");return k.yield(b.clearBuffer_(a,a.waitingToFlushBuffer,a.clearBufferSafeMargin),3);case 3:return k.return();case 2:if(a.stream.segmentIndex){k.jumpTo(4);break}d=a.stream;return k.yield(a.stream.createSegmentIndex(),5);case 5:if(d!=a.stream)return d.closeSegmentIndex&&(goog.asserts.assert(!a.stream.segmentIndex,"mediastate.stream should not have segmentIndex yet."),
|
|
@@ -954,9 +952,9 @@ a.type!=b.TEXT)return this.config_.updateIntervalSeconds/2;var c=shaka.media.Str
|
|
|
954
952
|
e,k=this.playerInterface_.mediaSourceEngine.bufferEnd(a.type);if(1E-6>h&&k)return shaka.log.debug(c,"buffered to end of presentation"),a.endOfStream=!0,a.type==b.VIDEO&&(a=this.mediaStates_.get(b.TEXT))&&shaka.media.StreamingEngine.isEmbeddedText_(a)&&(a.endOfStream=!0),null;a.endOfStream=!1;if(f>=g)return shaka.log.v2(c,"buffering goal met"),this.config_.updateIntervalSeconds/2;b=this.getSegmentReferenceNeeded_(a,d,k);if(!b)return this.config_.updateIntervalSeconds;f=Infinity;g=Array.from(this.mediaStates_.values());
|
|
955
953
|
g=$jscomp.makeIterator(g);for(h=g.next();!h.done;h=g.next())h=h.value,shaka.media.StreamingEngine.isEmbeddedText_(h)||h.segmentIterator&&!h.segmentIterator.current()||(h=this.getTimeNeeded_(h,d),f=Math.min(f,h));g=this.manifest_.presentationTimeline.getMaxSegmentDuration()*shaka.media.StreamingEngine.MAX_RUN_AHEAD_SEGMENTS_;if(e>=f+g)return shaka.log.v2(c,"waiting for other streams to buffer"),this.config_.updateIntervalSeconds;a.segmentPrefetch&&a.segmentIterator&&(c=b.initSegmentReference,!c||a.lastSegmentReference&&
|
|
956
954
|
shaka.media.InitSegmentReference.equal(c,a.lastInitSegmentReference)||a.segmentPrefetch.prefetchInitSegment(c),a.segmentPrefetch.prefetchSegments(b));this.fetchAndAppend_(a,d,b).catch(function(){});return null};shaka.media.StreamingEngine.prototype.getTimeNeeded_=function(a,b){return a.lastSegmentReference?a.lastSegmentReference.endTime:b};
|
|
957
|
-
shaka.media.StreamingEngine.prototype.getSegmentReferenceNeeded_=function(a,b,c){var d=shaka.media.StreamingEngine.logPrefix_(a);goog.asserts.assert(a.stream.segmentIndex,"segment index should have been generated already");if(a.segmentIterator)return a.segmentIterator.current();if(a.lastSegmentReference||c)return b=a.lastSegmentReference?a.lastSegmentReference.endTime:c,goog.asserts.assert(null!=b,"Should have a time to search"),shaka.log.v1(d,"looking up segment from new stream endTime:",b),a.
|
|
958
|
-
|
|
959
|
-
|
|
955
|
+
shaka.media.StreamingEngine.prototype.getSegmentReferenceNeeded_=function(a,b,c){var d=shaka.media.StreamingEngine.logPrefix_(a);goog.asserts.assert(a.stream.segmentIndex,"segment index should have been generated already");if(a.segmentIterator)return a.segmentIterator.current();if(a.lastSegmentReference||c)return b=a.lastSegmentReference?a.lastSegmentReference.endTime:c,goog.asserts.assert(null!=b,"Should have a time to search"),shaka.log.v1(d,"looking up segment from new stream endTime:",b),a.segmentIterator=
|
|
956
|
+
a.stream.segmentIndex.getIteratorForTime(b),a=a.segmentIterator&&a.segmentIterator.next().value,null==a&&shaka.log.warning(d,"cannot find segment","endTime:",b),a;c=this.config_.inaccurateManifestTolerance;var e=Math.max(b-c,0);shaka.log.v1(d,"looking up segment","lookupTime:",e,"presentationTime:",b);var f=null;c&&(a.segmentIterator=a.stream.segmentIndex.getIteratorForTime(e),f=a.segmentIterator&&a.segmentIterator.next().value);f||(a.segmentIterator=a.stream.segmentIndex.getIteratorForTime(b),f=
|
|
957
|
+
a.segmentIterator&&a.segmentIterator.next().value);null==f&&shaka.log.warning(d,"cannot find segment","lookupTime:",e,"presentationTime:",b);return f};
|
|
960
958
|
shaka.media.StreamingEngine.prototype.fetchAndAppend_=function(a,b,c){var d=this,e,f,g,h,k,l,m,n,p,q,r,t,w,u,v,x,y,z,A;return $jscomp.asyncExecutePromiseGeneratorProgram(function(B){switch(B.nextAddress){case 1:e=shaka.util.ManifestParserUtils.ContentType;f=shaka.media.StreamingEngine;g=f.logPrefix_(a);shaka.log.v1(g,"fetchAndAppend_:","presentationTime="+b,"reference.startTime="+c.startTime,"reference.endTime="+c.endTime);h=a.stream;k=a.segmentIterator;a.performingUpdate=!0;B.setCatchFinallyBlocks(2);
|
|
961
959
|
if(c.getStatus()==shaka.media.SegmentReference.Status.MISSING)throw new shaka.util.Error(shaka.util.Error.Severity.RECOVERABLE,shaka.util.Error.Category.NETWORK,shaka.util.Error.Code.SEGMENT_MISSING);return B.yield(d.initSourceBuffer_(a,c),4);case 4:d.destroyer_.ensureNotDestroyed();if(d.fatalError_)return B.return();shaka.log.v2(g,"fetching segment");l="video/mp4"==h.mimeType||"audio/mp4"==h.mimeType;m=window.ReadableStream;if(d.config_.lowLatencyMode&&m&&l&&(d.manifest_.type!=shaka.media.ManifestParser.HLS||
|
|
962
960
|
c.hasByterangeOptimization()))return q=new Uint8Array(0),t=r=!1,u=function(C){var I,E,G,D;return $jscomp.asyncExecutePromiseGeneratorProgram(function(F){switch(F.nextAddress){case 1:if(r)return F.return();t=!0;d.destroyer_.ensureNotDestroyed();if(d.fatalError_)return F.return();F.setCatchFinallyBlocks(2);q=d.concatArray_(q,C);I=!1;E=0;(new shaka.util.Mp4Parser).box("mdat",function(H){E=H.size+H.start;I=!0}).parse(q,!1,!0);if(!I){F.jumpTo(4);break}G=q.subarray(0,E);q=q.subarray(E);return F.yield(d.append_(a,
|
|
@@ -978,7 +976,7 @@ k,a.lastAppendWindowEnd=l,a.lastCodecs=m,a.lastMimeType=n,a.lastTimestampOffset=
|
|
|
978
976
|
a.lastAppendWindowStart=null;a.lastAppendWindowEnd=null;a.lastCodecs=null;a.lastTimestampOffset=null;throw B;})};return x.yield(t(),2)}shaka.media.InitSegmentReference.equal(b.initSegmentReference,a.lastInitSegmentReference)||(a.lastInitSegmentReference=b.initSegmentReference,b.isIndependent()&&b.initSegmentReference&&(shaka.log.v1(g,"fetching init segment"),w=c.fetch_(a,b.initSegmentReference),u=function(){var y,z,A,B,C,I,E;return $jscomp.asyncExecutePromiseGeneratorProgram(function(G){switch(G.nextAddress){case 1:return G.setCatchFinallyBlocks(2),
|
|
979
977
|
G.yield(w,4);case 4:return y=G.yieldResult,c.destroyer_.ensureNotDestroyed(),z=null,A=new Map,B=new shaka.util.Mp4Parser,C=shaka.util.Mp4Parser,B.box("moov",C.children).box("trak",C.children).box("mdia",C.children).fullBox("mdhd",function(D){goog.asserts.assert(null!=D.version,"MDHD is a full box and should have a valid version.");z=shaka.util.Mp4BoxParsers.parseMDHD(D.reader,D.version).timescale}).box("hdlr",function(D){switch(shaka.util.Mp4BoxParsers.parseHDLR(D.reader).handlerType){case "soun":A.set(d.AUDIO,
|
|
980
978
|
z);break;case "vide":A.set(d.VIDEO,z)}z=null}).parse(y),A.has(a.type)?b.initSegmentReference.timescale=A.get(a.type):null!=z&&(b.initSegmentReference.timescale=z),shaka.log.v1(g,"appending init segment"),I=a.stream.closedCaptions&&0<a.stream.closedCaptions.size,G.yield(c.playerInterface_.beforeAppendSegment(a.type,y),5);case 5:return G.yield(c.playerInterface_.mediaSourceEngine.appendBuffer(a.type,y,null,a.stream,I),6);case 6:G.leaveTryBlock(0);break;case 2:throw E=G.enterCatchBlock(),a.lastInitSegmentReference=
|
|
981
|
-
null,E;}})},c.playerInterface_.onInitSegmentAppended(b.startTime,b.initSegmentReference),h.push(u())));c.manifest_.sequenceMode&&(v=a.lastSegmentReference?a.lastSegmentReference.discontinuitySequence:null,b.discontinuitySequence!=v
|
|
979
|
+
null,E;}})},c.playerInterface_.onInitSegmentAppended(b.startTime,b.initSegmentReference),h.push(u())));c.manifest_.sequenceMode&&(v=a.lastSegmentReference?a.lastSegmentReference.discontinuitySequence:null,b.discontinuitySequence!=v&&h.push(c.playerInterface_.mediaSourceEngine.resync(a.type,b.startTime)));return x.yield(Promise.all(h),0)})};
|
|
982
980
|
shaka.media.StreamingEngine.prototype.append_=function(a,b,c,d,e,f){f=void 0===f?!1:f;var g=this,h,k,l,m,n,p,q;return $jscomp.asyncExecutePromiseGeneratorProgram(function(r){switch(r.nextAddress){case 1:h=shaka.media.StreamingEngine.logPrefix_(a);k=c.closedCaptions&&0<c.closedCaptions.size;m=null!=c.emsgSchemeIdUris&&0<c.emsgSchemeIdUris.length||g.config_.dispatchAllEmsgBoxes;n=g.config_.parsePrftBox&&!g.parsedPrftEventRaised_;if(m||n)l=new shaka.util.Mp4Parser;m&&l.fullBox("emsg",function(t){return g.parseEMSG_(d,
|
|
983
981
|
c.emsgSchemeIdUris,t)});n&&l.fullBox("prft",function(t){return g.parsePrft_(d,t)});(m||n)&&l.parse(e);return r.yield(g.evict_(a,b),2);case 2:return g.destroyer_.ensureNotDestroyed(),p=a.seeked,a.seeked=!1,q=a.adaptation,a.adaptation=!1,r.yield(g.playerInterface_.beforeAppendSegment(a.type,e),3);case 3:return r.yield(g.playerInterface_.mediaSourceEngine.appendBuffer(a.type,e,d,c,k,p,q,f),4);case 4:g.destroyer_.ensureNotDestroyed(),shaka.log.v2(h,"appended media segment"),r.jumpToEnd()}})};
|
|
984
982
|
shaka.media.StreamingEngine.prototype.parseEMSG_=function(a,b,c){if(0===c.version){var d=c.reader.readTerminatedString();var e=c.reader.readTerminatedString();var f=c.reader.readUint32();var g=c.reader.readUint32();var h=c.reader.readUint32();var k=c.reader.readUint32();var l=a.startTime+g/f}else f=c.reader.readUint32(),l=c.reader.readUint64()/f+a.timestampOffset,g=l-a.startTime,h=c.reader.readUint32(),k=c.reader.readUint32(),d=c.reader.readTerminatedString(),e=c.reader.readTerminatedString();c=c.reader.readBytes(c.reader.getLength()-
|
|
@@ -1219,7 +1217,7 @@ shaka.Player.prototype.goToLive=function(){this.isLive()?this.video_.currentTime
|
|
|
1219
1217
|
shaka.Player.prototype.getExpiration=function(){return this.drmEngine_?this.drmEngine_.getExpiration():Infinity};shaka.Player.prototype.getActiveSessionsMetadata=function(){return this.drmEngine_?this.drmEngine_.getActiveSessionsMetadata():[]};shaka.Player.prototype.getKeyStatuses=function(){return this.drmEngine_?this.drmEngine_.getKeyStatuses():{}};
|
|
1220
1218
|
shaka.Player.prototype.isBuffering=function(){var a=shaka.media.BufferingObserver.State;return this.bufferObserver_?this.bufferObserver_.getState()==a.STARVING:!1};shaka.Player.prototype.getPlaybackRate=function(){return this.video_?this.playRateController_?this.playRateController_.getRealRate():1:0};
|
|
1221
1219
|
shaka.Player.prototype.trickPlay=function(a){var b=this;goog.asserts.assert(0!=a,"Should never set a trick play rate of 0!");0==a?shaka.log.alwaysWarn("A trick play rate of 0 is unsupported!"):(this.trickPlayEventManager_.removeAll(),this.video_.paused&&this.video_.play(),this.playRateController_.set(a),this.loadMode_==shaka.Player.LoadMode.MEDIA_SOURCE&&(this.abrManager_.playbackRateChanged(a),this.streamingEngine_.setTrickPlay(1<Math.abs(a))),this.isLive()&&this.trickPlayEventManager_.listen(this.video_,
|
|
1222
|
-
"timeupdate",function(){var c=b.video_.currentTime,d=b.seekRange(),e=b.config_.streaming.safeSeekOffset;0<a?c>=d.end&&b.cancelTrickPlay():c<=d.start+e&&b.cancelTrickPlay()}))};
|
|
1220
|
+
"timeupdate",function(){var c=b.video_.currentTime,d=b.seekRange(),e=b.config_.streaming.safeSeekOffset;0<a?Math.floor(c)>=Math.floor(d.end)&&b.cancelTrickPlay():Math.floor(c)<=Math.floor(d.start+e)&&b.cancelTrickPlay()}))};
|
|
1223
1221
|
shaka.Player.prototype.cancelTrickPlay=function(){var a=this.playRateController_.getDefaultRate();this.loadMode_==shaka.Player.LoadMode.SRC_EQUALS&&this.playRateController_.set(a);this.loadMode_==shaka.Player.LoadMode.MEDIA_SOURCE&&(this.playRateController_.set(a),this.abrManager_.playbackRateChanged(a),this.streamingEngine_.setTrickPlay(!1));this.trickPlayEventManager_.removeAll()};
|
|
1224
1222
|
shaka.Player.prototype.getVariantTracks=function(){if(this.manifest_){for(var a=this.streamingEngine_?this.streamingEngine_.getCurrentVariant():null,b=[],c=0,d=$jscomp.makeIterator(this.manifest_.variants),e=d.next();!e.done;e=d.next())if(e=e.value,shaka.util.StreamUtils.isPlayable(e)){var f=shaka.util.StreamUtils.variantToTrack(e);f.active=e==a;f.active||1==c||null==a||e.video!=a.video||e.audio!=a.audio||(f.active=!0);f.active&&c++;b.push(f)}goog.asserts.assert(1>=c,"It should only have one active track");
|
|
1225
1223
|
return b}return this.video_&&this.video_.audioTracks?Array.from(this.video_.audioTracks).map(function(g){return shaka.util.StreamUtils.html5AudioTrackToTrack(g)}):[]};
|
|
@@ -1349,7 +1347,7 @@ goog.exportProperty(shaka.Player.prototype,"isInProgress",shaka.Player.prototype
|
|
|
1349
1347
|
goog.exportProperty(shaka.Player.prototype,"getMediaElement",shaka.Player.prototype.getMediaElement);goog.exportProperty(shaka.Player.prototype,"getManifestType",shaka.Player.prototype.getManifestType);goog.exportProperty(shaka.Player.prototype,"getLoadMode",shaka.Player.prototype.getLoadMode);goog.exportProperty(shaka.Player.prototype,"resetConfiguration",shaka.Player.prototype.resetConfiguration);goog.exportProperty(shaka.Player.prototype,"getBufferFullness",shaka.Player.prototype.getBufferFullness);
|
|
1350
1348
|
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,"releaseAllMutexes",shaka.Player.prototype.releaseAllMutexes);goog.exportProperty(shaka.Player.prototype,"load",shaka.Player.prototype.load);goog.exportProperty(shaka.Player.prototype,"updateStartTime",shaka.Player.prototype.updateStartTime);
|
|
1351
1349
|
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,"attachCanvas",shaka.Player.prototype.attachCanvas);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);
|
|
1352
|
-
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.6.
|
|
1350
|
+
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.6.17-debug";
|
|
1353
1351
|
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;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_++};
|
|
1354
1352
|
shaka.ads.AdsStats.prototype.getBlob=function(){return{loadTimes:this.loadTimes_,started:this.started_,playedCompletely:this.playedCompletely_,skipped:this.skipped_}};shaka.ads.ClientSideAd=function(a,b,c){var d=this;this.ad_=a;this.manager_=b;this.video_=c;this.isPaused_=!1;this.volume_=this.manager_.getVolume();this.eventManager_=new shaka.util.EventManager;this.eventManager_.listen(this.manager_,google.ima.AdEvent.Type.PAUSED,function(){d.isPaused_=!0});this.eventManager_.listen(this.manager_,google.ima.AdEvent.Type.RESUMED,function(){d.isPaused_=!1})};shaka.ads.ClientSideAd.prototype.getDuration=function(){return this.ad_.getDuration()};
|
|
1355
1353
|
shaka.ads.ClientSideAd.prototype.getMinSuggestedDuration=function(){return this.ad_.getMinSuggestedDuration()};shaka.ads.ClientSideAd.prototype.getRemainingTime=function(){return this.manager_.getRemainingTime()};shaka.ads.ClientSideAd.prototype.isPaused=function(){return this.isPaused_};shaka.ads.ClientSideAd.prototype.isSkippable=function(){return 0<=this.ad_.getSkipTimeOffset()};
|