how to add/remove childviewcontroller

Asked on 04/03/2025

1 search

To add or remove a child view controller in the context of multiview video playback in visionOS, you can follow these steps:

  1. Adding a Child View Controller:

    • Create a new AVPlayerViewController and set it up to play the chosen content.
    • Access its AVExperienceController and add Multiview to the allowed experiences.
    • Transition the experience controller to Multiview, and the AVMultiviewManager will handle the rest.
  2. Removing a Child View Controller:

    • Use the content browser to remove content from Multiview.
    • Transition the experience controller for that content to another allowed experience, such as "embedded."
    • If the corresponding AVPlayerViewController was not previously installed in a view hierarchy, the multiview manager will make it disappear.

For more detailed guidance, you can refer to the session Explore multiview video playback in visionOS (04:59).

how to add/remove childviewcontroller | Ask WWDC