VideoPlayer SwiftUI change background color

I added VideoPlayer view inside my project, but I noticed that during loading or with different aspect ratio the default color of this view is black.

I would like to change it according to to my app background.

Unfortunately using modifiers such as .background or .foregroundColor doesn't seem to change it. Is there a way to customize this color?

struct PlayerLooperView: View {
    private let queuePlayer: AVQueuePlayer!
    private let playerLooper: AVPlayerLooper!
    
    init(url: URL) {
        let playerItem = AVPlayerItem(url: url)
        self.queuePlayer = AVQueuePlayer(items: [playerItem])
        self.queuePlayer.isMuted = true
        self.playerLooper = AVPlayerLooper(player: queuePlayer, 
                                           templateItem: playerItem)
        self.queuePlayer.play()

    }
    
    var body: some View {
        VideoPlayer(player: queuePlayer)
            .disabled(true)
            .scaledToFit()
    }
}

Replies

You can probably overlay a ZStack with a Color view behind the VideoPlayer. Something like :

var body: some View {
    ZStack {
        backgroundColor
            .edgesIgnoringSafeArea(.all)
        VideoPlayer(player: queuePlayer)
            .disabled(true)
            .scaledToFit()
    }
}

Thanks, but It doesn't work, that black background is inside the player not under it