Skip to content

Conversation

@mmustafa-tse
Copy link
Contributor

Summary

  • A customer noticed that the getter for mediaTimeSpent calculates the value based on the difference between mediaSessionEndTimestamp and mediaSessionStartTimestamp, which leads to inaccuracy since mediaSessionEndTimestamp is only updated when logging a media event, with this PR it now calculates based on on the difference between m.unixTimeMillis (internal function for current time) and mediaSessionStartTimestamp
  • BrightScript does not support property getters like some object-oriented languages (e.g., Javascript, Kotlin and Swift), therefore a getter function on it's own was implemented on the mpCreateSGBridgeMediaApi level and to invoke it would be the same way we invoke other media functions such as logPlay(), logPause(), etc...
    m.mparticle.media.getMediaTimeSpent(mediaSession)

Testing Plan

  • Was this tested locally? If not, explain why.
  • E2E tested
  • Assigned as a custom attribute between media events i,e: customAttributes = { "Source": "Auto Playback", "testMediaTimeSpent": m.mparticle.media.getMediaTimeSpent(mediaSession).ToStr() }
    and results are below:
Screenshot 2025-07-02 at 9 41 20 AM Screenshot 2025-07-02 at 9 41 11 AM Screenshot 2025-07-02 at 9 41 39 AM

Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)

Copy link
Contributor

@BrandonStalnaker BrandonStalnaker left a comment

Choose a reason for hiding this comment

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

LGTM

@BrandonStalnaker BrandonStalnaker merged commit 7bb4b5d into mParticle:master Jul 7, 2025
1 check passed
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.

2 participants