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 invalid session ID in post roll ad sessions #82

Merged
merged 5 commits into from
Jul 24, 2024

Conversation

rolandkakonyi
Copy link
Contributor

@rolandkakonyi rolandkakonyi commented Jul 23, 2024

Problem

When playing a post-roll ad, "invalid session ID" error shows up on Conviva Touchstone.

Solution

Postponing ending the session from onPlaybackFinished event with a delay of 0.1s to check if there is an onAdBreakStarted event is received and then only end the session once onAdBreakFinished event is seen fixes the problem.

Notes

Both CSAI and SSAI ad integration were adjusted to address the problem overall.

Checklist

Comment on lines 621 to 622
DispatchQueue.main.asyncAfter(deadline: .now() + 0.10) { [weak self] in
guard let self else { return }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sneak: fixed missing weak reference

@@ -33,8 +33,8 @@ extension BitmovinPlayerListener: PlayerListener {
// The default SDK error handling is that it triggers the onSourceUnloaded before the onError event.
// To track errors to conviva we need to delay the onSourceUnloaded to ensure the onError event is
// called first.
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self.delegate?.onSourceUnloaded()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sneak: fixed missing weak reference

Comment on lines -148 to -155
DispatchQueue.main.asyncAfter(deadline: .now() + 0.10) {
expect(spy).notTo(
haveBeenCalled(
withArgs: [
CIS_SSDK_PLAYBACK_METRIC_PLAYER_STATE: "\(PlayerState.CONVIVA_BUFFERING.rawValue)"
]
)
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I replaced this pattern overall in this file to wrap it with waitUntil as there was no guarantee that the current test is still running when the asyncAfter executes the expect.

@rolandkakonyi rolandkakonyi marked this pull request as ready for review July 24, 2024 10:29
@rolandkakonyi rolandkakonyi requested a review from stonko1994 July 24, 2024 10:29
self.internalEndSession()
}
self.playbackFinishedDispatchWorkItem = playbackFinishedDispatchWorkItem
DispatchQueue.main.asyncAfter(deadline: .now() + 0.10, execute: playbackFinishedDispatchWorkItem)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit:

Suggested change
DispatchQueue.main.asyncAfter(deadline: .now() + 0.10, execute: playbackFinishedDispatchWorkItem)
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100), execute: playbackFinishedDispatchWorkItem)

or

Suggested change
DispatchQueue.main.asyncAfter(deadline: .now() + 0.10, execute: playbackFinishedDispatchWorkItem)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1, execute: playbackFinishedDispatchWorkItem)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in 865222d

Base automatically changed from feature/fix-analytics-video-data-auto-collecting to develop July 24, 2024 11:47
@rolandkakonyi rolandkakonyi merged commit 1d859f8 into develop Jul 24, 2024
3 checks passed
@rolandkakonyi rolandkakonyi deleted the feature/fix-invalid-session-ID-in-post-roll branch July 24, 2024 11:47
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