Skip to content

Conversation

@Mansi-mParticle
Copy link
Contributor

Instructions

  1. PR target branch should be against main
  2. PR title name should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-title-check.yml
  3. PR branch prefix should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-branch-check-name.yml

Summary

  • As per this doc, this PR adds an optional feature to automatically pause mediaContentTimeSpent during ad breaks. Previously, developers had to manually manage content time tracking, which could overstate media time if ad breaks were included.
  • This PR introduces an optional feature that allows mediaContentTimeSpent to be automatically paused when an ad break starts and resumed when it ends.

Testing Plan

  • Test Locally and added test case

Reference Issue

@sonarqubecloud
Copy link

Copy link

@nickolas-dimitrakas nickolas-dimitrakas left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@jamesnrokt jamesnrokt left a comment

Choose a reason for hiding this comment

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

Ran tests locally as there's no test steps on this repo, would be good to add as a verification step but if time pressured then LGTM

@Mansi-mParticle Mansi-mParticle merged commit c455557 into main Nov 14, 2025
4 checks passed
@Mansi-mParticle Mansi-mParticle deleted the feat/UpdateMediaContentTimeSpentSDKE-448 branch November 14, 2025 17:13
mediaSession.logAdBreakStart {
id = "break-2"
}
Thread.sleep(1000) // should count toward content time when flag disabled
Copy link
Member

Choose a reason for hiding this comment

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

this should be enabled since it's true

Choose a reason for hiding this comment

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

why didn't this comment stop the PR? this test is indeed asserting the opposite of what it should be.

Copy link
Member

@rmi22186 rmi22186 Nov 17, 2025

Choose a reason for hiding this comment

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

I actually added this comment after it was merged.

}

private fun pauseContentTimeIfAdBreakExclusionEnabled() {
if (!excludeAdBreaksFromContentTime) {

Choose a reason for hiding this comment

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

isn't this logic inverted?

streamType = builder.streamType.require("streamType")
logMPEvents = builder.logMPEvents
logMediaEvents = builder.logMediaEvents
this.excludeAdBreaksFromContentTime = builder.excludeAdBreaksFromContentTime

Choose a reason for hiding this comment

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

why do you have a different public and private way of describing the same thing? you use the word "exclude" here and "pause" in the public. that leads to confusion and perhaps even led to the bug noted below?

mediaSession.logPause()

val contentTime = mediaSession.mediaContentTimeSpent
assertEquals(2.0, contentTime)

Choose a reason for hiding this comment

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

this and any other asserts are going to be flakey. you can't guarantee the code is going to run for exactly this long.

mediaSession.logAdBreakStart {
id = "break-2"
}
Thread.sleep(1000) // should count toward content time when flag disabled

Choose a reason for hiding this comment

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

why didn't this comment stop the PR? this test is indeed asserting the opposite of what it should be.

mparticle-automation added a commit that referenced this pull request Dec 12, 2025
## [1.7.0](v1.6.0...v1.7.0) (2025-12-12)

### Features

* Update Media Content Time Spent Calculations with Ad Breaks ([#74](#74)) ([c455557](c455557))

### Bug Fixes

* adjust ad break exclusion logic ([#76](#76)) ([84b1493](84b1493))

### Updates & Maintenance

* Migrate from OSSRH to Central Publishing Portal ([#75](#75)) ([ac8de37](ac8de37))
@mparticle-automation
Copy link
Collaborator

🎉 This PR is included in version 1.7.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants