From 4049ad8c94f72928f301ba25a1a90ff0e41a16b1 Mon Sep 17 00:00:00 2001 From: remyderuiter Date: Tue, 12 Mar 2024 10:53:26 +0100 Subject: [PATCH 1/5] Report play head time to conviva analytics --- .../conviva/ConvivaAnalyticsIntegration.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java b/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java index f8e64b3..3490224 100644 --- a/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java +++ b/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java @@ -1,5 +1,7 @@ package com.bitmovin.analytics.conviva; +import static com.conviva.sdk.ConvivaSdkConstants.PLAYBACK.PLAY_HEAD_TIME; + import android.content.Context; import android.os.Handler; import android.util.Log; @@ -372,6 +374,7 @@ private void attachBitmovinEventListeners() { bitmovinPlayer.on(PlayerEvent.AdFinished.class, onAdFinishedListener); bitmovinPlayer.on(PlayerEvent.AdSkipped.class, onAdSkippedListener); bitmovinPlayer.on(PlayerEvent.AdError.class, onAdErrorListener); + bitmovinPlayer.on(PlayerEvent.TimeChanged.class, onVideoTimeChangedListener); bitmovinPlayer.on(PlayerEvent.VideoPlaybackQualityChanged.class, onVideoPlaybackQualityChangedListener); } @@ -680,5 +683,29 @@ public void onEvent(PlayerEvent.VideoPlaybackQualityChanged videoPlaybackQuality updateSession(); } }; + + private EventListener onVideoTimeChangedListener = new EventListener() { + @Override + public void onEvent(PlayerEvent.TimeChanged videoTimeChangedEvent) { + Log.d(TAG, "[Player Event] VideoTimeChanged"); + if (bitmovinPlayer.isLive()) { + double playerTimeshiftMax = bitmovinPlayer.getTimeShift(); + double playerTimeshift = bitmovinPlayer.getMaxTimeShift(); + long playerDurationMs = -(Math.round(playerTimeshiftMax * 1000)); + long playerPositionMs = playerDurationMs - -(Math.round(playerTimeshift * 1000)); + reportPlayHeadTime(playerPositionMs); + } else { + double currentTime = bitmovinPlayer.getCurrentTime(); + long playerDurationMs = (long) (currentTime * 1000); + reportPlayHeadTime(playerDurationMs); + } + } + }; + + private void reportPlayHeadTime(Long playerDurationMs) { + if (isSessionActive) { + convivaVideoAnalytics.reportPlaybackMetric(PLAY_HEAD_TIME, playerDurationMs); + } + } // endregion } From 36e9f08ee82c5d38672205d8ccec4e9ecc522c32 Mon Sep 17 00:00:00 2001 From: remyderuiter Date: Fri, 15 Mar 2024 08:51:52 +0100 Subject: [PATCH 2/5] Changelog update - Fix reporting --- CHANGELOG.md | 7 +++++++ conviva/build.gradle | 4 ++-- .../conviva/ConvivaAnalyticsIntegration.java | 14 +++++++------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e01e802..dfaef4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## 2.3.0 - 2024-03-14 +### Added +- New `TimeChanged` callback for reporting Playhead to conviva playback metric. Calculates Live and Vod playback for report. + +### Changed +- Updated conviva-core to 4.0.35 + ## 2.2.0 - 2023-07-18 ### Added - New `release(Boolean releaseConvivaSdk)` function allows for registering a new `ConvivaAnalyticsIntegration` to a diff --git a/conviva/build.gradle b/conviva/build.gradle index bd593cc..966d0eb 100644 --- a/conviva/build.gradle +++ b/conviva/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'maven-publish' apply from: "../bitmovinpropertiesloader.gradle" def packageName = 'com.bitmovin.analytics' -def libraryVersion = '2.2.0' +def libraryVersion = '2.3.0' android { compileSdkVersion rootProject.compileSdkVersion @@ -36,7 +36,7 @@ dependencies { testImplementation testingDependencies.junit androidTestImplementation testingDependencies.androidx_junit androidTestImplementation testingDependencies.androidx_espresso_core - api 'com.conviva.sdk:conviva-core-sdk:4.0.20' + api 'com.conviva.sdk:conviva-core-sdk:4.0.35' implementation bitmovinPlayerDependencies.bitmovinPlayer implementation 'org.apache.commons:commons-text:1.7' } diff --git a/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java b/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java index 3490224..910ae4d 100644 --- a/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java +++ b/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java @@ -374,7 +374,7 @@ private void attachBitmovinEventListeners() { bitmovinPlayer.on(PlayerEvent.AdFinished.class, onAdFinishedListener); bitmovinPlayer.on(PlayerEvent.AdSkipped.class, onAdSkippedListener); bitmovinPlayer.on(PlayerEvent.AdError.class, onAdErrorListener); - bitmovinPlayer.on(PlayerEvent.TimeChanged.class, onVideoTimeChangedListener); + bitmovinPlayer.on(PlayerEvent.TimeChanged.class, onTimeChangedListener); bitmovinPlayer.on(PlayerEvent.VideoPlaybackQualityChanged.class, onVideoPlaybackQualityChangedListener); } @@ -684,13 +684,13 @@ public void onEvent(PlayerEvent.VideoPlaybackQualityChanged videoPlaybackQuality } }; - private EventListener onVideoTimeChangedListener = new EventListener() { + private EventListener onTimeChangedListener = new EventListener() { @Override - public void onEvent(PlayerEvent.TimeChanged videoTimeChangedEvent) { - Log.d(TAG, "[Player Event] VideoTimeChanged"); + public void onEvent(PlayerEvent.TimeChanged timeChangedEvent) { + Log.d(TAG, "[Player Event] TimeChanged"); if (bitmovinPlayer.isLive()) { - double playerTimeshiftMax = bitmovinPlayer.getTimeShift(); - double playerTimeshift = bitmovinPlayer.getMaxTimeShift(); + double playerTimeshiftMax = bitmovinPlayer.getMaxTimeShift(); + double playerTimeshift = bitmovinPlayer.getTimeShift(); long playerDurationMs = -(Math.round(playerTimeshiftMax * 1000)); long playerPositionMs = playerDurationMs - -(Math.round(playerTimeshift * 1000)); reportPlayHeadTime(playerPositionMs); @@ -702,7 +702,7 @@ public void onEvent(PlayerEvent.TimeChanged videoTimeChangedEvent) { } }; - private void reportPlayHeadTime(Long playerDurationMs) { + private void reportPlayHeadTime(long playerDurationMs) { if (isSessionActive) { convivaVideoAnalytics.reportPlaybackMetric(PLAY_HEAD_TIME, playerDurationMs); } From c9996b6f215590c60d5db87169180eca3427a097 Mon Sep 17 00:00:00 2001 From: remyderuiter Date: Fri, 22 Mar 2024 08:51:27 +0100 Subject: [PATCH 3/5] Conform contribution docs --- CHANGELOG.md | 1 - conviva/build.gradle | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfaef4b..131eafe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] -## 2.3.0 - 2024-03-14 ### Added - New `TimeChanged` callback for reporting Playhead to conviva playback metric. Calculates Live and Vod playback for report. diff --git a/conviva/build.gradle b/conviva/build.gradle index 966d0eb..276a10b 100644 --- a/conviva/build.gradle +++ b/conviva/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'maven-publish' apply from: "../bitmovinpropertiesloader.gradle" def packageName = 'com.bitmovin.analytics' -def libraryVersion = '2.3.0' +def libraryVersion = '2.2.0' android { compileSdkVersion rootProject.compileSdkVersion From 998fcbdfb1fb5e02eb5323cacccd8aad4301bebf Mon Sep 17 00:00:00 2001 From: remyderuiter Date: Fri, 22 Mar 2024 09:52:03 +0100 Subject: [PATCH 4/5] Update readme version - remove log --- README.md | 2 +- .../bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index a323a56..2110580 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ allprojects { And these lines to your main project ``` dependencies { - implementation 'com.conviva.sdk:conviva-core-sdk:4.0.20' // <-- conviva sdk + implementation 'com.conviva.sdk:conviva-core-sdk:4.0.35' // <-- conviva sdk implementation 'com.bitmovin.analytics:conviva:2.2.0' } ``` diff --git a/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java b/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java index 910ae4d..56c0c04 100644 --- a/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java +++ b/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java @@ -687,7 +687,6 @@ public void onEvent(PlayerEvent.VideoPlaybackQualityChanged videoPlaybackQuality private EventListener onTimeChangedListener = new EventListener() { @Override public void onEvent(PlayerEvent.TimeChanged timeChangedEvent) { - Log.d(TAG, "[Player Event] TimeChanged"); if (bitmovinPlayer.isLive()) { double playerTimeshiftMax = bitmovinPlayer.getMaxTimeShift(); double playerTimeshift = bitmovinPlayer.getTimeShift(); From e804a5974c8590a400a5e04ad208fea9fde4c390 Mon Sep 17 00:00:00 2001 From: remyderuiter Date: Tue, 26 Mar 2024 10:14:33 +0100 Subject: [PATCH 5/5] Code review --- .../analytics/conviva/ConvivaAnalyticsIntegration.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java b/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java index 56c0c04..037b044 100644 --- a/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java +++ b/conviva/src/main/java/com/bitmovin/analytics/conviva/ConvivaAnalyticsIntegration.java @@ -1,7 +1,5 @@ package com.bitmovin.analytics.conviva; -import static com.conviva.sdk.ConvivaSdkConstants.PLAYBACK.PLAY_HEAD_TIME; - import android.content.Context; import android.os.Handler; import android.util.Log; @@ -410,6 +408,7 @@ private void detachBitmovinEventListeners() { bitmovinPlayer.off(PlayerEvent.AdFinished.class, onAdFinishedListener); bitmovinPlayer.off(PlayerEvent.AdSkipped.class, onAdSkippedListener); bitmovinPlayer.off(PlayerEvent.AdError.class, onAdErrorListener); + bitmovinPlayer.off(PlayerEvent.TimeChanged.class, onTimeChangedListener); bitmovinPlayer.off(PlayerEvent.VideoPlaybackQualityChanged.class, onVideoPlaybackQualityChangedListener); @@ -703,7 +702,7 @@ public void onEvent(PlayerEvent.TimeChanged timeChangedEvent) { private void reportPlayHeadTime(long playerDurationMs) { if (isSessionActive) { - convivaVideoAnalytics.reportPlaybackMetric(PLAY_HEAD_TIME, playerDurationMs); + convivaVideoAnalytics.reportPlaybackMetric(ConvivaSdkConstants.PLAYBACK.PLAY_HEAD_TIME, playerDurationMs); } } // endregion