File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,10 +37,10 @@ export default class ReactPlayer extends Component {
3737 let progress = { }
3838 const loaded = this . refs . player . getFractionLoaded ( )
3939 const played = this . refs . player . getFractionPlayed ( )
40- if ( ! this . prevLoaded || loaded !== this . prevLoaded ) {
40+ if ( loaded !== null && loaded !== this . prevLoaded ) {
4141 progress . loaded = this . prevLoaded = loaded
4242 }
43- if ( ! this . prevPlayed || played !== this . prevPlayed ) {
43+ if ( played !== null && played !== this . prevPlayed ) {
4444 progress . played = this . prevPlayed = played
4545 }
4646 if ( progress . loaded || progress . played ) {
Original file line number Diff line number Diff line change @@ -37,11 +37,11 @@ export default class FilePlayer extends Base {
3737 this . player . volume = fraction
3838 }
3939 getFractionPlayed ( ) {
40- if ( ! this . isReady ) return 0
40+ if ( ! this . isReady ) return null
4141 return this . player . currentTime / this . player . duration
4242 }
4343 getFractionLoaded ( ) {
44- if ( ! this . isReady ) return 0
44+ if ( ! this . isReady ) return null
4545 return this . player . buffered . end ( 0 ) / this . player . duration
4646 }
4747 render ( ) {
Original file line number Diff line number Diff line change @@ -94,11 +94,11 @@ export default class SoundCloud extends Base {
9494 this . player . setVolume ( fraction )
9595 }
9696 getFractionPlayed ( ) {
97- if ( ! this . isReady ) return 0
97+ if ( ! this . isReady ) return null
9898 return this . player . getCurrentPosition ( ) / this . player . getDuration ( )
9999 }
100100 getFractionLoaded ( ) {
101- if ( ! this . isReady ) return 0
101+ if ( ! this . isReady ) return null
102102 return this . player . getLoadedPosition ( ) / this . player . getDuration ( )
103103 }
104104 render ( ) {
Original file line number Diff line number Diff line change @@ -56,10 +56,10 @@ export default class Vimeo extends Base {
5656 this . postMessage ( 'setVolume' , fraction )
5757 }
5858 getFractionPlayed ( ) {
59- return this . fractionPlayed || 0
59+ return this . fractionPlayed || null
6060 }
6161 getFractionLoaded ( ) {
62- return this . fractionLoaded || 0
62+ return this . fractionLoaded || null
6363 }
6464 onMessage = e => {
6565 if ( ! MATCH_MESSAGE_ORIGIN . test ( e . origin ) ) return
Original file line number Diff line number Diff line change @@ -97,11 +97,11 @@ export default class YouTube extends Base {
9797 this . player . setVolume ( fraction * 100 )
9898 }
9999 getFractionPlayed ( ) {
100- if ( ! this . isReady ) return 0
100+ if ( ! this . isReady ) return null
101101 return this . player . getCurrentTime ( ) / this . player . getDuration ( )
102102 }
103103 getFractionLoaded ( ) {
104- if ( ! this . isReady ) return 0
104+ if ( ! this . isReady ) return null
105105 return this . player . getVideoLoadedFraction ( )
106106 }
107107 render ( ) {
You can’t perform that action at this time.
0 commit comments