From 63ee0f5493afcbe44c0ca650ad19b19a81f65e6d Mon Sep 17 00:00:00 2001 From: Dan Ziv Date: Wed, 13 Jun 2018 13:21:03 +0300 Subject: [PATCH] FEC-8309 --- src/kava.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/kava.js b/src/kava.js index 480a004b..a7ff6af5 100644 --- a/src/kava.js +++ b/src/kava.js @@ -20,7 +20,6 @@ export default class Kava extends BasePlugin { _viewEventEnabled: boolean; _firstPlayRequestTime: number; _bufferStartTime: number; - _previousCurrentTime: number; _isFirstPlay: boolean; _isEnded: boolean; _isPaused: boolean; @@ -103,7 +102,6 @@ export default class Kava extends BasePlugin { } _resetFlags(): void { - this._previousCurrentTime = 0; this._isFirstPlay = true; this._isEnded = false; this._isPaused = false; @@ -131,7 +129,6 @@ export default class Kava extends BasePlugin { return; } - this._updatePlayTimeSumModel(); if (this._isBuffering) { this._updateBufferModel(); this._bufferStartTime = Date.now(); @@ -214,6 +211,7 @@ export default class Kava extends BasePlugin { _onReport(): void { if (this._viewEventEnabled) { + this._updatePlayTimeSumModel(); this._sendAnalytics(KavaEventModel.VIEW); } else { this.logger.warn(`VIEW event blocked because server response of viewEventsEnabled=false`); @@ -250,7 +248,6 @@ export default class Kava extends BasePlugin { } _onSeeking(): void { - this._previousCurrentTime = this.player.currentTime; this._model.updateModel({targetPosition: this.player.currentTime}); this._sendAnalytics(KavaEventModel.SEEK); } @@ -268,7 +265,6 @@ export default class Kava extends BasePlugin { } _onTimeUpdate(): void { - this._updatePlayTimeSumModel(); const percent = this.player.currentTime / this.player.duration; if (!this._timePercentEvent.PLAY_REACHED_25 && percent >= 0.25) { this._timePercentEvent.PLAY_REACHED_25 = true; @@ -362,9 +358,8 @@ export default class Kava extends BasePlugin { } _updatePlayTimeSumModel(): void { - const delta = this.player.currentTime - this._previousCurrentTime; + const delta = this.config.viewEventCountdown - this._model.getBufferTime(); this._model.updateModel({playTimeSum: this._model.getPlayTimeSum() + delta}); - this._previousCurrentTime = this.player.currentTime; } _setModelDelegates() {