@@ -53,6 +53,9 @@ shaka.media.GapJumpingController = class {
5353 /** @private {shaka.util.EventManager} */
5454 this . eventManager_ = new shaka . util . EventManager ( ) ;
5555
56+ /** @private {boolean} */
57+ this . started_ = false ;
58+
5659 /** @private {boolean} */
5760 this . seekingEventReceived_ = false ;
5861
@@ -90,7 +93,7 @@ shaka.media.GapJumpingController = class {
9093 */
9194 this . gapJumpTimer_ = new shaka . util . Timer ( ( ) => {
9295 this . onPollGapJump_ ( ) ;
93- } ) . tickEvery ( this . config_ . gapJumpTimerTime ) ;
96+ } ) ;
9497 }
9598
9699
@@ -134,16 +137,22 @@ shaka.media.GapJumpingController = class {
134137 * @param {number } startTime
135138 */
136139 onStarted ( startTime ) {
140+ this . started_ = true ;
137141 if ( this . video_ . seeking && ! this . seekingEventReceived_ ) {
138142 this . seekingEventReceived_ = true ;
139143 this . startTime_ = startTime ;
140144 }
145+ if ( this . gapJumpTimer_ ) {
146+ this . gapJumpTimer_ . tickEvery ( this . config_ . gapJumpTimerTime ) ;
147+ }
148+ this . onPollGapJump_ ( ) ;
141149 }
142150
143151 /** Called when a seek has started. */
144152 onSeeking ( ) {
145153 this . seekingEventReceived_ = true ;
146154 this . hadSegmentAppended_ = false ;
155+ this . onPollGapJump_ ( ) ;
147156 }
148157
149158
@@ -167,6 +176,10 @@ shaka.media.GapJumpingController = class {
167176 if ( this . video_ . readyState == 0 ) {
168177 return ;
169178 }
179+ // Don't gap jump before playback started
180+ if ( ! this . started_ ) {
181+ return ;
182+ }
170183 // Do not gap jump if seeking has begun, but the seeking event has not
171184 // yet fired for this particular seek.
172185 if ( this . video_ . seeking ) {
0 commit comments