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

Tracker RichMedia refresh never sent #108

Open
xploit42 opened this issue Jan 25, 2021 · 4 comments
Open

Tracker RichMedia refresh never sent #108

xploit42 opened this issue Jan 25, 2021 · 4 comments

Comments

@xploit42
Copy link

Hello,
We are using AtInternet/Tracker to track RichMedia events. As advised in the documentation we send event synchronously on an Analytics Queue.
Recently we experienced issues with the refresh events, they are no longer sent.
In DynamicRefresh.swift I set breakpoints in start() and process(). It stops in start but process() is never executed.
It seems we encounter this issue since we updated to Xcode 12.
A workaround is to send the sendPlay(dynamicRefreshConfiguration: ) on MainThread.

@nsagnett
Copy link
Contributor

Hi,

Can you share some parts of your tagging code ?

@xploit42
Copy link
Author

I created a sample code that reproduces our issue

import Tracker

class ATInternetDebug {

    let tracker: Tracker
    lazy var mediaPlayer: MediaPlayer = tracker.mediaPlayers.add()
    let queue = DispatchQueue(label: "analytics")
    var audio: RichMedia?

    init() {
        tracker = ATInternet.sharedInstance.tracker(AppConstants.ATInternet.trackerName,
                                                    configuration: AppConstants.ATInternet.trackerConfiguration)
        tracker.enableDebugger = true
        setupRichMedia()
    }

    func setupRichMedia() {
        audio = mediaPlayer.media.add("label",
                                      mediaTheme1: "theme1",
                                      mediaTheme2: "theme2",
                                      mediaType: "type",
                                      duration: 42)
    }

    func sendPlay() {
        queue.sync {
            audio?.sendPlay(dynamicRefreshConfiguration: [0: 10])
        }
    }
}

I tested it by calling sendPlay() for both main en global() as following

        // With this one I don't get the refresh events
        DispatchQueue.global().async {
            self.atDebugger.sendPlay()
        }
        
        // With this one I get the refresh events
        DispatchQueue.main.async {
            self.atDebugger.sendPlay()
        }

I only have the refresh events when calling my function on main thread.

In both case at timer initialisation (DynamicRefresh.swift L29) we are on our custom serial queue (analytics).

Hope this can help

@nsagnett
Copy link
Contributor

Hum, the problem is SDK is not safe for concurrent use and global() queue use concurrency unfortunately

@xploit42
Copy link
Author

The events are sent by our player which is on another DispatchQueue, it will never be sent on the main thread. This is why in my sample I dispatched on global().

In my sendPlay() func I dispatch on my "analytics" serial queue, this should work doesn't it?

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

No branches or pull requests

2 participants