in SwiftUI I add a Videoplayer, but the frame is not really 16:9, but the video's are.
private let player = AVPlayer(url: URL(string: UserDefaults.standard.string(forKey: "videoURL") ?? "https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4")!)
With this view:
ZStack {
VideoPlayer(player: player)
.onAppear() {
player.play()
}.frame(
idealWidth: .infinity,
maxWidth: .infinity,
idealHeight: (UIScreen.main.bounds.height / 3) * 1.75,
maxHeight: UIScreen.main.bounds.height - 600,
alignment: .center
)
}
.background(
RoundedRectangle(cornerRadius: 40.0)
.stroke(Color(.red), lineWidth: 5)
.overlay(
RoundedRectangle(cornerRadius: 40.0)
.fill(Color(.black))
)
)
The Player is working and shown correctly, but with a black background on the both sides.. I want it red, so it does look prettier than random black in the red block.
Is there a way to change the background color of the black sideparts? I tried edgesIgnoringSafeArea with no luck.
Little but of how it looks like now, where you see the black "borders" on the side;
