Creating a multiview video playback experience in visionOS. There is no back button on the player.

Function Introduction "https://developer.apple.com/documentation/avkit/creating-a-multiview-video-playback-experience-in-visionos/"

When I use this function, my videoPlayer has no back Action in player. And we did not find any method provided by the system "addChildViewControllerAndView(form)"

"https://developer.apple.com/documentation/avkit/adopting-the-system-player-interface-in-visionos" Referencing this document also did not work

As long as you enter this line of code

let playerController = AVPlayerViewController()
// Enable the multiview experience along with the default recommended set.
playerController.experienceController.allowedExperiences = .recommended(including: [.multiview])

there is no back button, only full screen and zoom out

Hey @Liangmu,

The addChildViewControllerAndView function is not a system provided function but rather a convenience function that encapsulates the steps required to add a child view controller. To learn more on the steps required to do this see Creating a custom container view controller.

Could you provide more information on when you are expecting a back button? There is no such button when the video player is playing in the embedded state. When the video is playing in full screen mode there is a button that closes the video player which returns you to the embedded state and/or your content. Do you not have such a button?

Let me know if that helps. Michael

Hi Michael, Could you try adding this code in the "DestinationVideo" demo:

controller.experienceController.allowedExperiences = .recommended(excluding: [.multiview])

I couldn’t find the addChildViewControllerAndView method. However, my implementation matches the example from the link you provided. I originally thought this method might include options for setting the video to full screen, but it seems it’s only for handling UI.

Also, I found an issue in the “DestinationVideo” demo with versions before visionOS 2.1. In the video playback page, when opening the playlist and selecting a video to play, the playlist doesn’t close automatically, which makes it impossible to interact. I tried using dismiss() in selectionAction, but it didn’t work either. It works fine in visionOS 2.1.

When I enable the multi-screen functionality, the back button disappears…

Hey @Liangmu,

Using the experienceController is mutually exclusive with the view controller’s existing API for managing the experience. Once you start using the experienceController, you must call .transition(to: .expanded) to transition the video to the expanded state. This is why you see the video presented in the embedded state with the controls contained within the window rather than seeing the video shown in the expanded state with the controls presented in an ornament.

DestinationVideo showcases the video playback APIs that use the view controller's API for managing the experience, it does not highlight the use of experience controller that is used for multiview playback.

Please let me know if you have additional questions,
Michael

I want this kind of display

The effect shown now

Creating a multiview video playback experience in visionOS. There is no back button on the player.
 
 
Q