Skip to content

Commit

Permalink
439 improve current media item tracker (#440)
Browse files Browse the repository at this point in the history
Co-authored-by: Gaëtan Muller <[email protected]>
  • Loading branch information
StaehliJ and MGaetan89 authored Feb 15, 2024
1 parent b7ab56d commit 1d40aaa
Show file tree
Hide file tree
Showing 18 changed files with 1,261 additions and 1,039 deletions.
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ androidx-media3-ui-leanback = { group = "androidx.media3", name = "media3-ui-lea
androidx-media3-dash = { group = "androidx.media3", name = "media3-exoplayer-dash", version.ref = "androidx-media3" }
androidx-media3-hls = { group = "androidx.media3", name = "media3-exoplayer-hls", version.ref = "androidx-media3" }
androidx-media3-session = { group = "androidx.media3", name = "media3-session", version.ref = "androidx-media3" }
androidx-media3-test-utils = { group = "androidx.media3", name = "media3-test-utils", version.ref = "androidx-media3" }
androidx-media3-test-utils-robolectric = { group = "androidx.media3", name = "media3-test-utils-robolectric", version.ref = "androidx-media3" }
androidx-media = { group = "androidx.media", name = "media", version.ref = "androidx-media" }
okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" }
okhttp-logging-interceptor = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,17 @@ class MediaCompositionMediaItemSource(
if (resource.tokenType == Resource.TokenType.AKAMAI) {
uri = appendTokenQueryToUri(uri)
}
val trackerData = mediaItem.getMediaItemTrackerData()
trackerDataProvider?.update(trackerData, resource, chapter, result)
trackerData.putData(SRGEventLoggerTracker::class.java, null)
getComScoreData(result, chapter, resource)?.let {
trackerData.putData(ComScoreTracker::class.java, it)
}
getCommandersActData(result, chapter, resource)?.let {
trackerData.putData(CommandersActTracker::class.java, it)
}
val trackerData = mediaItem.getMediaItemTrackerData().buildUpon().apply {
trackerDataProvider?.update(this, resource, chapter, result)
putData(SRGEventLoggerTracker::class.java, null)
getComScoreData(result, chapter, resource)?.let {
putData(ComScoreTracker::class.java, it)
}
getCommandersActData(result, chapter, resource)?.let {
putData(CommandersActTracker::class.java, it)
}
}.build()

return mediaItem.buildUpon()
.setMediaMetadata(fillMetaData(mediaItem.mediaMetadata, chapter))
.setDrmConfiguration(fillDrmConfiguration(resource))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ interface TrackerDataProvider {
/**
* Update tracker data with given integration layer data.
*
* @param trackerData The [MediaItemTrackerData] to update.
* @param trackerData The [MediaItemTrackerData.Builder] to update.
* @param resource The selected [Resource].
* @param chapter The selected [Chapter].
* @param mediaComposition The loaded [MediaComposition].
*/
fun update(
trackerData: MediaItemTrackerData,
trackerData: MediaItemTrackerData.Builder,
resource: Resource,
chapter: Chapter,
mediaComposition: MediaComposition
Expand Down
Loading

0 comments on commit 1d40aaa

Please sign in to comment.