Repository navigation
Release 0.0.4 - #3
Merged
Merged
Conversation
OMManager.createSession now activates AVAudioSession per video OMID session (setCategory(.playback, .mixWithOthers) + setActive(true)), matching sdk-swift v3 PR #119 and the IAB OMSDK demo. The previous one-shot lazy activation through AudioInfoProvider froze device-volume KVO after first /preload, so hardware volume events never reached the verification script. Hand-verified against the IAB validator proxy — deviceVolume changes now fire correctly. No deactivation path: setActive(false, .notifyOthersOnDeactivation) is what caused the 1s audio-cut bug fixed in sdk-flutter PR #51. `.mixWithOthers` keeps the permanent active session gentle on host audio. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restores per-session
AVAudioSessionactivation for OMID video sessions, fixing a regression where hardware device-volume changes were not delivered to the IAB OMID verification script.What changed
OMManager.createSession, forcreativeType == .video, now inlines:```swift
let session = AVAudioSession.sharedInstance()
try? session.setCategory(.playback, mode: .default, options: [.mixWithOthers])
try? session.setActive(true)
```
…called per video OMID session, immediately before the OMID context is created. Matches the IAB OMSDK demo's
WebViewVideoController.swiftand the sdk-swift v3 PR #119 pattern that was IAB-certified.Why this is necessary
Prior to this release,
OMManager.createSessionrouted throughAudioInfoProvider.ensureSessionActive()— a one-shot lazy static. First access typically came fromAudioInfoProvider.collect()during the very first/preload(long before any video ad). By the time a video OMID session started, the static had already evaluated andensureSessionActive()was a no-op.That broke OMID's internal
outputVolumeKVO observer in practice: even with.mixWithOthers, the WKWebView's video element appears to take over audio focus, and iOS stops publishing volume KVO events to observers that registered before the video session was active. Re-issuingsetActive(true)per-session refreshes the publishing pipeline.Hand-verified against the IAB Validator Proxy: with the new pattern,
volumeChangeevents now carry updateddeviceVolumevalues on every hardware volume press (verifieddeviceVolume: 0 → 0.05 → 0.15 → 0.20 → 0.15 → 0.20 → 0.30 → 0.40 → 0.45 → 0.40 → 0.30 → 0.40 → 0.45across two test sessions).What was NOT changed
The "never deactivate" decision stays.
setActive(false, .notifyOthersOnDeactivation)is what produced the 1-second audio-cut bug fixed in sdk-flutter PR #51, and.mixWithOthersmakes a permanent active session gentle on host audio. The new code only ever callssetActive(true)— neversetActive(false).The earlier
AudioInfoProvider.ensureSessionActive()lazy static remains in place for/preload'sgetDevice()consumer (which uses it to keepoutputVolumelive for device-info collection); it's just no longer relied on for OMID's per-session KVO.Test plan
xcodebuild clean test -scheme KontextKit -destination 'platform=iOS Simulator,name=iPhone 16 Pro,OS=latest,arch=arm64' -skipPackagePluginValidation— greenPackage.swiftpinned to local path): play a video ad, press hardware volume up/down, verifyvolumeChangeevents with updateddeviceVolumearrive at the IAB Validator Proxypod lib lint KontextKit.podspec --allow-warnings --use-libraries0.0.4, GitHub release,pod trunk push KontextKit.podspec --allow-warnings --use-libraries🤖 Generated with Claude Code