Hello @leandrool ,
Sending pings to the Media SDK during a pre-roll ad in a live stream can indeed be challenging, especially since, as you’ve seen, the granularAdTrackingEnabled setting only supports pings every second for VOD, not for live streams. This limitation is due to how the SDK handles live data.
However, there’s a workaround that can get you close to what you need. By setting up a manual ping loop to run every second during the ad, you can achieve a similar effect. In Swift, you can use a repeating timer that triggers the trackEvent method at one-second intervals for the ad’s duration.
Here’s the general idea:
- Start a Timer: When the pre-roll ad starts, set up a timer to fire each second.
- Send Events: Each time the timer fires, call your trackEvent method to log each “ping” with Adobe Media Analytics.
- Stop the Timer: Once the ad ends or is interrupted, stop the timer.
Here’s a basic example in Swift :
var adPingTimer: Timer?
func startAdPing() {
adPingTimer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { [weak self] _ in
// Use your custom tracking method or event
MediaTracker.trackEvent(.adStart) // Adjust the event as needed
}
}
func stopAdPing() {
adPingTimer?.invalidate()
adPingTimer = nil
}
This setup relies on the app’s client-side control to keep timing in sync, so while it might not match native VOD tracking exactly, it’s a reliable workaround that has worked well in similar cases.
Let me know if this helps get things up and running!