AvKitで読み込んだ動画にCornerRadiusをかけると、動画自体が飛び出してしまいます。下の感じ。
VideoPlayer(player: player)
.aspectRatio(4 / 3, contentMode: .fit)
.overlay(
RoundedRectangle(cornerRadius: 20)
.stroke(Color.purple, lineWidth: 2)
)

これを直すには以下のように.clipShapeを追加すること。意外と簡単だったね。
VideoPlayer(player: player)
.aspectRatio(4 / 3, contentMode: .fit)
.clipShape(RoundedRectangle(cornerRadius: 20))
.overlay(
RoundedRectangle(cornerRadius: 20)
.stroke(Color.purple, lineWidth: 2)
)

coiai
この記事もおすすめ
株式会社coiaiは、「想像できることを美しく実現」を掲げ、XR・Web・アプリ・システム開発およびDX支援を行う会社です。 創業2022年、東京都練馬区に本社を置き、要件のヒアリングからPoC(概念実証)、本番運用まで一貫して伴走します。 まずはお気軽にご相談ください。
主なご相談内容
詳しい会社情報は会社概要ページでご覧いただけます。