pillarbox-apple
pillarbox-apple copied to clipboard
Minor visual glitch in the multi-instance demo
Description of the problem
When toggling the active view in the MultiView
demo the previous view can briefly be seen:
https://github.com/SRGSSR/pillarbox-apple/assets/170201/7f29d7ff-0278-449a-997e-39768a35298a
Relevant stack trace or log output
No response
Reproducibility
Always
Steps to reproduce
- Open the Multi-instance demo available from the Showcase tab.
- Tap on each view in sequence and observe the video boxes.
Library version
0.8.0
Operating system
iOS 17.2
Code sample
If you update the PiP supporting video view as follows:
struct PictureInPictureSupportingVideoView: UIViewRepresentable {
let player: Player
let gravity: AVLayerVideoGravity
static func dismantleUIView(_ uiView: VideoLayerView, coordinator: Void) {
PictureInPicture.shared.custom.relinquish(for: uiView.playerLayer)
}
func makeUIView(context: Context) -> VideoLayerView {
let view = VideoLayerView(from: PictureInPicture.shared.custom.playerLayer)
PictureInPicture.shared.custom.acquire(for: view.playerLayer)
return view
}
func updateUIView(_ uiView: VideoLayerView, context: Context) {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
uiView.player = player.queuePlayer
uiView.playerLayer.videoGravity = gravity
}
}
}
The delay lets you see the video view update sequence. The glitch results from the fact we reuse a previous layer. There is likely a way to mitigate it.
Is there an existing issue for this?
- [X] I have searched existing issues and found no similar bug report.
Slight flickering also visible in the opt-in demo when toggling the PiP option, once #702 has been merged.