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

Fix vmap mid roll ad position reporting #83

Merged
merged 8 commits into from
Sep 24, 2024

Conversation

strangesource
Copy link
Contributor

Problem

Ad position reporting for client side ad insertion with VMAP and Google IMA ads integration was reporting wrong ad position for mid- and post-roll ads.

Changes

As the timing information on the ad is not reported correctly for VMAP ads (tracked internally), we take the correct time from the current active ad break. This is in line with the tacking on web.

@strangesource strangesource self-assigned this Sep 24, 2024
@strangesource strangesource force-pushed the fix-vmap-mid-roll-ad-position-reporting branch from f46e691 to 0a229a1 Compare September 24, 2024 11:37
verify { videoAnalytics.reportAdBreakStarted(any(), any()) }
player.listeners[PlayerEvent.AdStarted::class]?.forEach { it(TEST_AD_STARTED_EVENT) }
verify {
adAnalytics.reportAdStarted(match { it["c3.ad.position"] == AdPosition.PREROLL })
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know this match helper. Nice!

Comment on lines 276 to 290
ad = object : Ad {
override val clickThroughUrl: String?
get() = "clickThroughUrl"
override val data: AdData?
get() = null
override val height: Int
get() = 100
override val id: String?
get() = null
override val isLinear: Boolean
get() = true
override val mediaFileUrl: String?
get() = null
override val width: Int
get() = 200
Copy link

@krocard krocard Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nit. Why implement this though getters rather than fields?

Suggested change
ad = object : Ad {
override val clickThroughUrl: String?
get() = "clickThroughUrl"
override val data: AdData?
get() = null
override val height: Int
get() = 100
override val id: String?
get() = null
override val isLinear: Boolean
get() = true
override val mediaFileUrl: String?
get() = null
override val width: Int
get() = 200
ad = object : Ad {
override val clickThroughUrl = "clickThroughUrl"
override val data = null
override val height = 100
override val id = null
override val isLinear = true
override val mediaFileUrl = null
override val width = 200

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7ee0bd3 I went for a mock to make it easier to read.


// mid-roll ad break is scheduled at 15 seconds, will play immediately in case of the DASH
// live stream due to absolute time stamps.
player.expectEvent<PlayerEvent.AdBreakStarted> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't callAndExpectEvent be used instead? The AdBreak start could be missed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in theory this could be cary. Unfortunately the test helpers seem to have an issue that cause a deadlock when loading in the callAndExpectEvent. 🙈 I'll keep it as-is. We should have a look at the test helpers at some point.

Copy link
Contributor

@matamegger matamegger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
Besides some style nits, nothing to add to the other review.

strangesource and others added 2 commits September 24, 2024 15:53
…AnalyticsIntegrationTest.kt

Co-authored-by: Matthias Tamegger <[email protected]>
…AnalyticsIntegrationTest.kt

Co-authored-by: Matthias Tamegger <[email protected]>
@strangesource strangesource merged commit 3938a88 into develop Sep 24, 2024
3 checks passed
@strangesource strangesource deleted the fix-vmap-mid-roll-ad-position-reporting branch September 24, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants