From c13a3df2ad8d92b257a945e386db385d9779d5f4 Mon Sep 17 00:00:00 2001 From: Shalom Meoded Date: Tue, 29 Jan 2019 15:48:00 +0200 Subject: [PATCH] fix(FEC-8606): "Play 100%" event is not sent on IE11 Win7 (#30) `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. --- src/kava.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kava.js b/src/kava.js index e540adb3..47b45305 100644 --- a/src/kava.js +++ b/src/kava.js @@ -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);