'Is there any simpler way to play a video with AVPlayer()? Swift / SwiftUI
import SwiftUI
import AVKit
import CoreMedia
struct ContentView: View {
@State private var player = AVPlayer(url: URL(string: "https://dm0qx8t0i9gc9.cloudfront.net/watermarks/video/GTYSdDW/beautiful-lake-resort-aerial-view-pond-water-nature_bnv45jc__2aba2d157e11b16d8db8eb534fa013aa__P360.mp4")!)
var body: some View {
VStack {
VideoPlayer(player: player)
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
