I'm running into this same problem when trying to observe values from the KVO-compliant timeControlStatus property on AVPlayer:
init() {
self.player = AVPlayer()
Task { [weak self] in
guard let self else { return }
// Observe changes to timeControlStatus using Combine on the AVPlayer
for await newValue in player.publisher(for: \.timeControlStatus).values {
isPlaying = newValue == .playing // this only gets called for the initial value and never again, the loop does not exit
}
}
}
Post
Replies
Boosts
Views
Activity
If you're building with a Workspace, in addition to making sure it's a local dependency in your project, you're also going to want to add it to the workspace file as a group:
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:MISSING_PACKAGE">
</FileRef>
...
</Workspace>
This is what allowed it to work in my setup on XCode Cloud where it was failing before.