VideoPlayer in SwiftUI (iOS 14 +)
iOS 14 brought AVKit
to the world of SwiftUI
with the introduction of VideoPlayer
view. VideoPlayer
displays content of an AVPlayer
instance. View
is defined inside AVKit
framework and lets us play videos natively in SwiftUI
without the need of porting functionality over from UIKit
.
VideoPlayer
takes player as an initialization parameter, which is an instance of AVPlayer.