Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

439 improve current media item tracker #440

Merged
merged 13 commits into from
Feb 15, 2024
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
Loading