From 1a9f42f20f3ac61cdb1019b19b9fbd4a8d66a07b Mon Sep 17 00:00:00 2001 From: GouravSna <38206744+GouravSna@users.noreply.github.com> Date: Thu, 17 Feb 2022 23:16:40 +0530 Subject: [PATCH] - Update `lastReportedAdPlayhead` value in AdProgress event (#90) --- .../plugins/youbora/PKYouboraAdsAdapter.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/youboraplugin/src/main/java/com/kaltura/playkit/plugins/youbora/PKYouboraAdsAdapter.java b/youboraplugin/src/main/java/com/kaltura/playkit/plugins/youbora/PKYouboraAdsAdapter.java index 486b8c8..c845f1d 100644 --- a/youboraplugin/src/main/java/com/kaltura/playkit/plugins/youbora/PKYouboraAdsAdapter.java +++ b/youboraplugin/src/main/java/com/kaltura/playkit/plugins/youbora/PKYouboraAdsAdapter.java @@ -164,7 +164,7 @@ private void populateAdValues() { log.d("lastReportedAdResource: " + lastReportedAdResource); log.d("lastReportedAdDuration: " + lastReportedAdDuration); log.d("lastReportedAdTitle: " + lastReportedAdTitle); - log.d("lastReportedAdPlayhead: " + lastReportedAdPlayhead); + printLastReportedAdPlayhead(); log.d("lastReportedAdBitrate: " + lastReportedAdBitrate); } @@ -244,7 +244,7 @@ private void addListeners() { currentAdInfo = event.adInfo; lastReportedAdPlayhead = Long.valueOf(currentAdInfo.getAdPlayHead() / Consts.MILLISECONDS_MULTIPLIER).doubleValue(); lastReportedAdBitrate = currentAdInfo.getMediaBitrate(); - log.d("lastReportedAdPlayhead: " + lastReportedAdPlayhead); + printLastReportedAdPlayhead(); fireStart(); fireJoin(); sendReportEvent(event.eventType()); @@ -259,7 +259,7 @@ private void addListeners() { currentAdInfo = event.adInfo; lastReportedAdPlayhead = Long.valueOf(currentAdInfo.getAdPlayHead() / Consts.MILLISECONDS_MULTIPLIER).doubleValue(); lastReportedAdBitrate = currentAdInfo.getMediaBitrate(); - log.d("lastReportedAdPlayhead: " + lastReportedAdPlayhead); + printLastReportedAdPlayhead(); firePause(); sendReportEvent(event.eventType()); }); @@ -272,7 +272,7 @@ private void addListeners() { currentAdInfo = event.adInfo; lastReportedAdPlayhead = Long.valueOf(currentAdInfo.getAdPlayHead() / Consts.MILLISECONDS_MULTIPLIER).doubleValue(); lastReportedAdBitrate = currentAdInfo.getMediaBitrate(); - log.d("lastReportedAdPlayhead: " + lastReportedAdPlayhead); + printLastReportedAdPlayhead(); fireResume(); sendReportEvent(event.eventType()); }); @@ -283,7 +283,7 @@ private void addListeners() { return; } lastReportedAdPlayhead = lastReportedAdDuration; - log.d("lastReportedAdPlayhead: " + lastReportedAdPlayhead); + printLastReportedAdPlayhead(); fireStop(); sendReportEvent(event.eventType()); }); @@ -353,12 +353,13 @@ private void addListeners() { }); messageBus.addListener(this, AdEvent.playHeadChanged, event -> { - lastReportedAdPlayhead = Long.valueOf(event.adPlayHead).doubleValue(); //We are not sending this event to youbora, //so prevent it from dispatching through YouboraEvent.YouboraReport. }); messageBus.addListener(this, AdEvent.adProgress, event -> { + lastReportedAdPlayhead = Long.valueOf(event.currentAdPosition / Consts.MILLISECONDS_MULTIPLIER).doubleValue(); + printLastReportedAdPlayhead(); //We are not sending this event to youbora, //so prevent it from dispatching through YouboraEvent.YouboraReport. });