SwiftUI - VideoPlayer bug

I encounter a problem with VideoPlayer on SwiftUI (Xcode 12.0.1), it doesn't play online or offline videos. I tried on real device (iPad iOS 14.0.1) and simulators and I got the same result. It's like it starts to play the first frame and the it stops, the play button is disabled.

I simply add the following code in my ContentView :

Code Block language
import AVKit
VideoPlayer(player: AVPlayer(url: URL(string: "https://bit.ly/swswift")!))

I found someone who got the same bug (here) but it was on Xcode beta and iOS beta, it would be really strange that this bug still occurs in release versions.

Could you please just test on your side and tell me if you get the same result?
Thanks you.

Here's my console when I try to use VideoPlayer :
  • 2020-09-30 09:05:15.364332+0200 MrChickenApp[870:214157] <CATransformLayer: 0x2822d2e80> - changing property masksToBounds in transform-only layer, will have no effect

  • 2020-09-30 09:05:15.364734+0200 MrChickenApp[870:214157] <CATransformLayer: 0x2822d3ee0> - changing property masksToBounds in transform-only layer, will have no effect

  • 2020-09-30 09:05:15.366618+0200 MrChickenApp[870:214157] <CATransformLayer: 0x2822e8680> - changing property masksToBounds in transform-only layer, will have no effect

  • 2020-09-30 09:05:15.370750+0200 MrChickenApp[870:214157] <CATransformLayer: 0x2822ef600> - changing property masksToBounds in transform-only layer, will have no effect

  • 2020-09-30 09:05:15.372214+0200 MrChickenApp[870:214157] <CATransformLayer: 0x2822ef8c0> - changing property masksToBounds in transform-only layer, will have no effect

2020-09-30 09:05:15.403266+0200 MrChickenApp[870:214157] <CATransformLayer: 0x2822e8680> - changing property allowsGroupBlending in transform-only layer, will have no effect
  • 2020-09-30 09:05:15.403441+0200 MrChickenApp[870:214157] <CATransformLayer: 0x2822ef600> - changing property allowsGroupBlending in transform-only layer, will have no effect

[2]: https://developer.apple.com/forums/thread/650741
It works for me in Xcode 12.0.1 + Simulator iPhone 11 Pro and on an iPhone 11 Pro.
The video plays well beyond the first frame and the play button is enabled.
It works for me in Xcode 12.0.1 and Simulator iPhone 11 Pro, but does not work in Simulator Apple TV 4K

I thought the same thing; however, if I wait long enough, the play button will eventually appear. Seems like there should be some progress indicator showing the video is loading.
I’m experiencing something that might be related.

My first tab has a VideoPlayer and another view in an HStack. The video comes up, shows controls, and responds to all taps.

Tab two is a full screen version of that same VideoPlayer view. The first frame of the video comes up but I never see controls or any ability to start the video.

I’ve tried making different views wondering if there is a limitation of having only one of the VideoPlayers or what but I can’t find a way to get tab 2 to work.

I have latest XCode and iOS as of 10/17/20.

I have the same error using Xcode 12.5 and iPads 14.5.1

CATransformLayer: 0x282798de0> - changing property masksToBounds in transform-only layer, will have no effect

import SwiftUI import AVKit

struct ContentDetailView: View {

    @EnvironmentObject var model: ContentModel

    

    var body: some View {

        

        let lesson = model.currentLesson

        let url = URL(string: Constants.videoHostUrl + (lesson?.video ?? ""))

        

        VStack {

            // Only show video if we get a valid URL

            if url != nil {

                VideoPlayer(player: AVPlayer(url: url!))

                    .cornerRadius(10)

SwiftUI - VideoPlayer bug
 
 
Q