Skip to content

Commit

Permalink
Check null before accessing FilePlayer properties
Browse files Browse the repository at this point in the history
  • Loading branch information
zzh8829 committed Aug 16, 2018
1 parent 52d98ad commit 77e0305
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/players/FilePlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,15 @@ export class FilePlayer extends Component {
this.player.playbackRate = rate
}
getDuration () {
if (!this.player) return null
return this.player.duration
}
getCurrentTime () {
if (!this.player) return null
return this.player.currentTime
}
getSecondsLoaded () {
if (!this.player) return null
const { buffered } = this.player
if (buffered.length === 0) {
return 0
Expand Down

0 comments on commit 77e0305

Please sign in to comment.