@@ -4036,19 +4036,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
4036
4036
this . bufferObserver_ ,
4037
4037
'Need a buffering observer to update' ) ;
4038
4038
4039
- let bufferedToEnd ;
4040
- switch ( this . loadMode_ ) {
4041
- case shaka . Player . LoadMode . SRC_EQUALS :
4042
- bufferedToEnd = this . isBufferedToEndSrc_ ( ) ;
4043
- break ;
4044
- case shaka . Player . LoadMode . MEDIA_SOURCE :
4045
- bufferedToEnd = this . isBufferedToEndMS_ ( ) ;
4046
- break ;
4047
- default :
4048
- bufferedToEnd = false ;
4049
- break ;
4050
- }
4051
-
4039
+ const bufferedToEnd = this . isEnded ( ) || this . playhead_ . isBufferedToEnd ( ) ;
4052
4040
const bufferLead = shaka . media . TimeRangesUtils . bufferedAheadOf (
4053
4041
this . video_ . buffered ,
4054
4042
this . video_ . currentTime ) ;
@@ -9119,83 +9107,6 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
9119
9107
return pairings ;
9120
9108
}
9121
9109
9122
- /**
9123
- * Assuming the player is playing content with media source, check if the
9124
- * player has buffered enough content to make it to the end of the
9125
- * presentation.
9126
- *
9127
- * @return {boolean }
9128
- * @private
9129
- */
9130
- isBufferedToEndMS_ ( ) {
9131
- goog . asserts . assert (
9132
- this . video_ ,
9133
- 'We need a video element to get buffering information' ) ;
9134
- goog . asserts . assert (
9135
- this . mediaSourceEngine_ ,
9136
- 'We need a media source engine to get buffering information' ) ;
9137
- goog . asserts . assert (
9138
- this . manifest_ ,
9139
- 'We need a manifest to get buffering information' ) ;
9140
-
9141
- // This is a strong guarantee that we are buffered to the end, because it
9142
- // means the playhead is already at that end.
9143
- if ( this . isEnded ( ) ) {
9144
- return true ;
9145
- }
9146
-
9147
- // This means that MediaSource has buffered the final segment in all
9148
- // SourceBuffers and is no longer accepting additional segments.
9149
- if ( this . mediaSourceEngine_ . ended ( ) ) {
9150
- return true ;
9151
- }
9152
-
9153
- // Live streams are "buffered to the end" when they have buffered to the
9154
- // live edge or beyond (into the region covered by the presentation delay).
9155
- if ( this . manifest_ . presentationTimeline . isLive ( ) ) {
9156
- const liveEdge =
9157
- this . manifest_ . presentationTimeline . getSegmentAvailabilityEnd ( ) ;
9158
- const bufferEnd =
9159
- shaka . media . TimeRangesUtils . bufferEnd ( this . video_ . buffered ) ;
9160
-
9161
- if ( bufferEnd != null && bufferEnd >= liveEdge ) {
9162
- return true ;
9163
- }
9164
- }
9165
-
9166
- return false ;
9167
- }
9168
-
9169
- /**
9170
- * Assuming the player is playing content with src=, check if the player has
9171
- * buffered enough content to make it to the end of the presentation.
9172
- *
9173
- * @return {boolean }
9174
- * @private
9175
- */
9176
- isBufferedToEndSrc_ ( ) {
9177
- goog . asserts . assert (
9178
- this . video_ ,
9179
- 'We need a video element to get buffering information' ) ;
9180
-
9181
- // This is a strong guarantee that we are buffered to the end, because it
9182
- // means the playhead is already at that end.
9183
- if ( this . isEnded ( ) ) {
9184
- return true ;
9185
- }
9186
-
9187
- // If we have buffered to the duration of the content, it means we will have
9188
- // enough content to buffer to the end of the presentation.
9189
- const bufferEnd =
9190
- shaka . media . TimeRangesUtils . bufferEnd ( this . video_ . buffered ) ;
9191
-
9192
- // Because Safari's native HLS reports slightly inaccurate values for
9193
- // bufferEnd here, we use a fudge factor. Without this, we can end up in a
9194
- // buffering state at the end of the stream. See issue #2117.
9195
- const fudge = 1 ; // 1000 ms
9196
- return bufferEnd != null && bufferEnd >= this . video_ . duration - fudge ;
9197
- }
9198
-
9199
9110
/**
9200
9111
* Create an error for when we purposely interrupt a load operation.
9201
9112
*
0 commit comments