Skip to content

Commit

Permalink
fix(FEC-8606): "Play 100%" event is not sent on IE11 Win7 (#30)
Browse files Browse the repository at this point in the history
`const percent = this.player.currentTime / this.player.duration`, returned a number above 1 on IE 11, therefore, never entered, the if (!this._timePercentEvent.PLAY_REACHED_100 && percent === 1) condition.

The fix:

Limiting the float to have only 2 decimals at the end using the toFixed function.
Parsing the calculation using parseFloat function.
  • Loading branch information
Shalom Meoded authored and OrenMe committed Jan 29, 2019
1 parent 1f87ce4 commit c13a3df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/kava.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class Kava extends BasePlugin {
_onTimeUpdate(): void {
if (!this.player.isLive()) {
this._updatePlayTimeSumModel();
const percent = this.player.currentTime / this.player.duration;
const percent = parseFloat((this.player.currentTime / this.player.duration).toFixed(2));
if (!this._timePercentEvent.PLAY_REACHED_25 && percent >= 0.25) {
this._timePercentEvent.PLAY_REACHED_25 = true;
this._sendAnalytics(KavaEventModel.PLAY_REACHED_25_PERCENT);
Expand Down

0 comments on commit c13a3df

Please sign in to comment.