Skip to content

Commit

Permalink
fix: playbackState crashing if this.player not set (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwallberg committed Feb 23, 2022
1 parent 823bfbe commit c3c4380
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PlayerAnalyticsConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ export class PlayerAnalyticsConnector {

private playbackState(): TBaseEvent {
const playhead =
!this.player.currentTime && this.player.currentTime !== 0
!this.player?.currentTime && this.player?.currentTime !== 0
? -1
: this.player.currentTime || 0;
const duration =
!this.player.duration && this.player.duration !== 0
!this.player?.duration && this.player?.duration !== 0
? -1
: this.player.duration || 0;
return {
Expand Down

0 comments on commit c3c4380

Please sign in to comment.