@@ -52,7 +52,9 @@ class SeekBar extends Slider {
5252 this . on ( this . player_ , 'timeupdate' , this . update ) ;
5353 this . on ( this . player_ , 'ended' , this . handleEnded ) ;
5454 this . on ( this . player_ , 'durationchange' , this . update ) ;
55- this . on ( this . player_ . liveTracker , 'liveedgechange' , this . update ) ;
55+ if ( this . player_ . liveTracker ) {
56+ this . on ( this . player_ . liveTracker , 'liveedgechange' , this . update ) ;
57+ }
5658
5759 // when playing, let's ensure we smoothly update the play progress bar
5860 // via an interval
@@ -69,7 +71,7 @@ class SeekBar extends Slider {
6971 } ) ;
7072
7173 this . on ( this . player_ , [ 'ended' , 'pause' , 'waiting' ] , ( e ) => {
72- if ( this . player_ . liveTracker . isLive ( ) && e . type !== 'ended' ) {
74+ if ( this . player_ . liveTracker && this . player_ . liveTracker . isLive ( ) && e . type !== 'ended' ) {
7375 return ;
7476 }
7577
@@ -109,11 +111,11 @@ class SeekBar extends Slider {
109111 const liveTracker = this . player_ . liveTracker ;
110112 let duration = this . player_ . duration ( ) ;
111113
112- if ( liveTracker . isLive ( ) ) {
114+ if ( liveTracker && liveTracker . isLive ( ) ) {
113115 duration = this . player_ . liveTracker . liveCurrentTime ( ) ;
114116 }
115117
116- if ( liveTracker . seekableEnd ( ) === Infinity ) {
118+ if ( liveTracker && liveTracker . seekableEnd ( ) === Infinity ) {
117119 this . disable ( ) ;
118120 } else {
119121 this . enable ( ) ;
@@ -194,7 +196,7 @@ class SeekBar extends Slider {
194196 let percent ;
195197 const liveTracker = this . player_ . liveTracker ;
196198
197- if ( liveTracker . isLive ( ) ) {
199+ if ( liveTracker && liveTracker . isLive ( ) ) {
198200 percent = ( currentTime - liveTracker . seekableStart ( ) ) / liveTracker . liveWindow ( ) ;
199201
200202 // prevent the percent from changing at the live edge
@@ -247,7 +249,7 @@ class SeekBar extends Slider {
247249 const distance = this . calculateDistance ( event ) ;
248250 const liveTracker = this . player_ . liveTracker ;
249251
250- if ( ! liveTracker . isLive ( ) ) {
252+ if ( ! liveTracker || ! liveTracker . isLive ( ) ) {
251253 newTime = distance * this . player_ . duration ( ) ;
252254
253255 // Don't let video end while scrubbing.
0 commit comments