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()
}
}