Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'child view controller:<IMAAdViewController: 0x7fa542343260> should have parent view controller:<VideoplayerWrapperLib.PIPViewController: 0x7fa53ff38ce0> but actual parent is:<VideoplayerWrapper.ViewController: 0x7fa542007060>'
It seems that this issue is not unknown :
https://groups.google.com/g/ima-sdk/c/Z6icBTi59Ms
https://groups.google.com/g/ima-sdk/c/NyHuNuE7QDI
Thanks for your help 😀
Best regards,
Alexis
|
||||||

|
||||||
extension UIView {
func findViewController() -> UIViewController? {
if let nextResponder = self.next as? UIViewController {
return nextResponder
} else if let nextResponder = self.next as? UIView {
return nextResponder.findViewController()
} else {
return nil
}
}
}
Then, when I want to move the Player :if let playerView = JWPlayerManager.shared.getPlayerView() {
if let subviews = playerView.subviews.first?.subviews,
subviews.count > 1,
let imaViewController = subviews[1].findViewController() {
let imaView = subviews[1]
imaViewController.willMove(toParent: parentViewController)
playerView.removeFromSuperview()
parentViewController.addChild(imaViewController)
container.addSubview(playerView)
playerView.constraintToSuperview(superView: container)
imaViewController.didMove(toParent: parentViewController)
}
Sorry for all this code. I hope it won't look too messy. So, I can properly migrate the IMAAdViewController from a view to an other... but I lose the controls ! There is an other controller in the view, a IMAWebUIViewController, according the the following screenshot :

I am still trying to migrate the two viewControllers at the same time. If you have any clues 😀
Maybe my code will also help people.
Best regards,
Alexis
Hi Alexis,
Thank you for your response.
Could you please confirm if you have followed this guide for supporting PiP in your application that is using the IMA SDK? Would you also be able to share with us the sample project implementation you are currently working on? Upon submitting, I will raise it to the rest of the team to have it check and further investigate, and possibly advise how to achieve your goal.
You can share the requested sample via "reply to author" or send it directly to our testing alias imate...@gmail.com
Regards,
|
||||||
|
||||||
|
||||||
Hi Alexis,
Thank you for responding back to us. I believe you are referring to skipTimeOffset functionality. This feature will let you know the number of seconds of playback before the ad becomes skippable. It will return a value of -1 for non skippable ads or if this is unavailable.
Regards,
|
||||||