3

Caught a strange situation. In the new version of iOS, the controls for the video player are not shown if the video player is placed inside the list.

In iOS 15.6.1 this code works fine as it should.

struct ContentView: View
{
    var body: some View
    {
        VStack{
            List(0..<2) { i in
                VStack
                {
                   
                    let vp = AVPlayer(url: URL(string: "http://wiu.ks-api.com/Content/file_3004.mp4")!)
                    
                    VideoPlayer(player: vp)
                        .frame(maxWidth: .infinity, idealHeight: 320)
                        .padding(.horizontal, -20)
                        .onDisappear{vp.pause()}
                }
            }
        }
    }
}

Thank you all in advance

Eugene
  • 151
  • 8
  • Same thing is happening in a TabView for me when setting `.tabViewStyle(.page(indexDisplayMode: .never))`, if removed it works. – 1337holiday Sep 16 '22 at 20:40

1 Answers1

6

You can add .clipped() modifier to VideoPlayer() it works inside TabView .tabViewStyle(.page)