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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.6.17](https://github.com/shaka-project/shaka-player/compare/v4.6.16...v4.6.17) (2024-04-15)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Correct playhead when seek beyond seekRange ([#6304](https://github.com/shaka-project/shaka-player/issues/6304)) ([09b154e](https://github.com/shaka-project/shaka-player/commit/09b154ed7a2f1539a239436b2cb8f76b464e4308))
9
+ * **HLS:** Fix labelling of captions in Safari ([#6426](https://github.com/shaka-project/shaka-player/issues/6426)) ([f5fa229](https://github.com/shaka-project/shaka-player/commit/f5fa229181997133fcab40db113b411180810192))
10
+ * Looser tolerance for ending trick play at edge of seek range. ([#6422](https://github.com/shaka-project/shaka-player/issues/6422)) ([4edf77e](https://github.com/shaka-project/shaka-player/commit/4edf77e8106ee550a3d32c90c572efec179a6b27)), closes [#6421](https://github.com/shaka-project/shaka-player/issues/6421)
11
+
12
+
13
+ ### Reverts
14
+
15
+ * Fix potential AV sync issues after seek or adaptation ([#6435](https://github.com/shaka-project/shaka-player/issues/6435)) ([3a231dd](https://github.com/shaka-project/shaka-player/commit/3a231ddfce62a2f0ef0b7340a798e062d9814c24)), closes [#5785](https://github.com/shaka-project/shaka-player/issues/5785) [#4589](https://github.com/shaka-project/shaka-player/issues/4589)
16
+
3
17
  ## [4.6.16](https://github.com/shaka-project/shaka-player/compare/v4.6.15...v4.6.16) (2024-04-09)
4
18
 
5
19
 
package/dist/locales.js CHANGED
@@ -724,46 +724,46 @@ shaka.ui.Locales.addTo = function(localization) {
724
724
  * @const
725
725
  */
726
726
  shaka.ui.Locales.Ids = {
727
- SEEK: 'SEEK',
728
- OFF: 'OFF',
727
+ FAST_FORWARD: 'FAST_FORWARD',
728
+ REWIND: 'REWIND',
729
729
  PAUSE: 'PAUSE',
730
- RESOLUTION: 'RESOLUTION',
731
- NOT_APPLICABLE: 'NOT_APPLICABLE',
732
- MULTIPLE_LANGUAGES: 'MULTIPLE_LANGUAGES',
733
- UNDETERMINED_LANGUAGE: 'UNDETERMINED_LANGUAGE',
734
- CAST: 'CAST',
735
- LANGUAGE: 'LANGUAGE',
736
- MUTE: 'MUTE',
737
- SKIP_TO_LIVE: 'SKIP_TO_LIVE',
738
- LIVE: 'LIVE',
739
730
  PICTURE_IN_PICTURE: 'PICTURE_IN_PICTURE',
740
731
  FULL_SCREEN: 'FULL_SCREEN',
741
- ENTER_LOOP_MODE: 'ENTER_LOOP_MODE',
742
- ON: 'ON',
743
- UNMUTE: 'UNMUTE',
732
+ EXIT_LOOP_MODE: 'EXIT_LOOP_MODE',
733
+ MUTE: 'MUTE',
734
+ MULTIPLE_LANGUAGES: 'MULTIPLE_LANGUAGES',
735
+ NOT_APPLICABLE: 'NOT_APPLICABLE',
736
+ OFF: 'OFF',
737
+ RESOLUTION: 'RESOLUTION',
738
+ AD_DURATION: 'AD_DURATION',
739
+ AD_TIME: 'AD_TIME',
740
+ CAST: 'CAST',
741
+ PLAY: 'PLAY',
742
+ AIRPLAY: 'AIRPLAY',
743
+ SURROUND: 'SURROUND',
744
+ UNDETERMINED_LANGUAGE: 'UNDETERMINED_LANGUAGE',
744
745
  STATISTICS: 'STATISTICS',
745
- AD_PROGRESS: 'AD_PROGRESS',
746
- EXIT_FULL_SCREEN: 'EXIT_FULL_SCREEN',
747
- REPLAY: 'REPLAY',
748
- BACK: 'BACK',
749
- REWIND: 'REWIND',
750
- UNRECOGNIZED_LANGUAGE: 'UNRECOGNIZED_LANGUAGE',
751
- SKIP_AD: 'SKIP_AD',
746
+ LOOP: 'LOOP',
752
747
  VOLUME: 'VOLUME',
753
- AD_DURATION: 'AD_DURATION',
754
748
  PLAYBACK_RATE: 'PLAYBACK_RATE',
755
- PLAY: 'PLAY',
756
- AD_TIME: 'AD_TIME',
749
+ CAPTIONS: 'CAPTIONS',
750
+ SEEK: 'SEEK',
751
+ AD_PROGRESS: 'AD_PROGRESS',
757
752
  QUALITY: 'QUALITY',
758
- FAST_FORWARD: 'FAST_FORWARD',
759
- EXIT_LOOP_MODE: 'EXIT_LOOP_MODE',
753
+ MORE_SETTINGS: 'MORE_SETTINGS',
754
+ EXIT_PICTURE_IN_PICTURE: 'EXIT_PICTURE_IN_PICTURE',
755
+ ENTER_LOOP_MODE: 'ENTER_LOOP_MODE',
760
756
  AUTO_QUALITY: 'AUTO_QUALITY',
761
- AIRPLAY: 'AIRPLAY',
762
- LOOP: 'LOOP',
757
+ EXIT_FULL_SCREEN: 'EXIT_FULL_SCREEN',
758
+ UNMUTE: 'UNMUTE',
763
759
  SUBTITLE_FORCED: 'SUBTITLE_FORCED',
764
- CAPTIONS: 'CAPTIONS',
760
+ LANGUAGE: 'LANGUAGE',
765
761
  ENTER_PICTURE_IN_PICTURE: 'ENTER_PICTURE_IN_PICTURE',
766
- EXIT_PICTURE_IN_PICTURE: 'EXIT_PICTURE_IN_PICTURE',
767
- MORE_SETTINGS: 'MORE_SETTINGS',
768
- SURROUND: 'SURROUND',
762
+ SKIP_TO_LIVE: 'SKIP_TO_LIVE',
763
+ LIVE: 'LIVE',
764
+ ON: 'ON',
765
+ BACK: 'BACK',
766
+ REPLAY: 'REPLAY',
767
+ UNRECOGNIZED_LANGUAGE: 'UNRECOGNIZED_LANGUAGE',
768
+ SKIP_AD: 'SKIP_AD',
769
769
  };
@@ -312,8 +312,7 @@ shaka.util.StreamUtils.textStreamToTrack=function(a){return{id:a.id,active:!1,ty
312
312
  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}};
313
313
  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,
314
314
  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}};
315
- shaka.util.StreamUtils.html5TrackId=function(a){a.__shaka_id||(a.__shaka_id=shaka.util.StreamUtils.nextTrackId_++);return a.__shaka_id};
316
- 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};
315
+ 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};
317
316
  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};
318
317
  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,
319
318
  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)})};
@@ -782,7 +781,7 @@ function(){return g.getStartTime_(d)});this.checkWindowTimer_=new shaka.util.Tim
782
781
  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)};
783
782
  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()};
784
783
  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()};
785
- 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&&(b=this.reposition_(a),shaka.log.info("Jumping forward "+(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)};
784
+ 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)};
786
785
  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_()};
787
786
  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};
788
787
  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+
@@ -868,8 +867,8 @@ a.updateTimer&&this.scheduleUpdate_(a,0)):(shaka.log.debug(c,"clear: handling ri
868
867
  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);
869
868
  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();
870
869
  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()})};
871
- 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,needsResync:!1,recovering:!1,
872
- hasError:!1,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};
870
+ 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,
871
+ 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};
873
872
  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))};
874
873
  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");
875
874
  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."),
@@ -880,9 +879,9 @@ a.type!=b.TEXT)return this.config_.updateIntervalSeconds/2;var c=shaka.media.Str
880
879
  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());
881
880
  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&&
882
881
  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};
883
- 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.needsResync=
884
- !0,a.segmentIterator=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),
885
- f=a.segmentIterator&&a.segmentIterator.next().value);null==f&&shaka.log.warning(d,"cannot find segment","lookupTime:",e,"presentationTime:",b);return f};
882
+ 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=
883
+ 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=
884
+ a.segmentIterator&&a.segmentIterator.next().value);null==f&&shaka.log.warning(d,"cannot find segment","lookupTime:",e,"presentationTime:",b);return f};
886
885
  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);
887
886
  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||
888
887
  c.hasByterangeOptimization()))return q=new Uint8Array(0),t=r=!1,u=function(E){var I,D,G,C;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,E);I=!1;D=0;(new shaka.util.Mp4Parser).box("mdat",function(H){D=H.size+H.start;I=!0}).parse(q,!1,!0);if(!I){F.jumpTo(4);break}G=q.subarray(0,D);q=q.subarray(D);return F.yield(d.append_(a,
@@ -904,7 +903,7 @@ k,a.lastAppendWindowEnd=l,a.lastCodecs=m,a.lastMimeType=n,a.lastTimestampOffset=
904
903
  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,E,I,D;return $jscomp.asyncExecutePromiseGeneratorProgram(function(G){switch(G.nextAddress){case 1:return G.setCatchFinallyBlocks(2),
905
904
  G.yield(w,4);case 4:return y=G.yieldResult,c.destroyer_.ensureNotDestroyed(),z=null,A=new Map,B=new shaka.util.Mp4Parser,E=shaka.util.Mp4Parser,B.box("moov",E.children).box("trak",E.children).box("mdia",E.children).fullBox("mdhd",function(C){goog.asserts.assert(null!=C.version,"MDHD is a full box and should have a valid version.");z=shaka.util.Mp4BoxParsers.parseMDHD(C.reader,C.version).timescale}).box("hdlr",function(C){switch(shaka.util.Mp4BoxParsers.parseHDLR(C.reader).handlerType){case "soun":A.set(d.AUDIO,
906
905
  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 D=G.enterCatchBlock(),a.lastInitSegmentReference=
907
- null,D;}})},c.playerInterface_.onInitSegmentAppended(b.startTime,b.initSegmentReference),h.push(u())));c.manifest_.sequenceMode&&(v=a.lastSegmentReference?a.lastSegmentReference.discontinuitySequence:null,b.discontinuitySequence!=v||a.needsResync)&&(a.needsResync=!1,h.push(c.playerInterface_.mediaSourceEngine.resync(a.type,b.startTime)));return x.yield(Promise.all(h),0)})};
906
+ null,D;}})},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)})};
908
907
  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,
909
908
  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()}})};
910
909
  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()-
@@ -1145,7 +1144,7 @@ shaka.Player.prototype.goToLive=function(){this.isLive()?this.video_.currentTime
1145
1144
  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():{}};
1146
1145
  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};
1147
1146
  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_,
1148
- "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()}))};
1147
+ "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()}))};
1149
1148
  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()};
1150
1149
  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");
1151
1150
  return b}return this.video_&&this.video_.audioTracks?Array.from(this.video_.audioTracks).map(function(g){return shaka.util.StreamUtils.html5AudioTrackToTrack(g)}):[]};
@@ -1275,7 +1274,7 @@ goog.exportProperty(shaka.Player.prototype,"isInProgress",shaka.Player.prototype
1275
1274
  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);
1276
1275
  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);
1277
1276
  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);
1278
- 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.16-debug";
1277
+ 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";
1279
1278
  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_++};
1280
1279
  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()};
1281
1280
  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()};