Post

Replies

Boosts

Views

Activity

Main thread blocked using AVPlayer in SwiftUI
Hi folks, iOS 17.4 - iPhone 14 Pro - Real device I'm facing an error when I try to implement a simple VideoPlayer view: Main thread blocked by synchronous property query on not-yet-loaded property (PreferredTransform) for HTTP(S) asset. This could have been a problem if this asset were being read from a slow network. This is the code I'm using to show the video player: struct ContentView: View { let player = AVPlayer(url: URL(string: "https://video.twimg.com/amplify_video/1760315643142750208/vid/avc1/640x360/-1etorSK7w2g9Nlc.mp4?tag=16")!) var body: some View { VideoPlayer(player: player) } } I noticed that the bundle initi method of AVPlayer doesn't trigger this error: AVPlayer(url: Bundle.main.url(forResource: "video", withExtension: "mp4")!) I also tried to load metadata's asset with: try await AVAsset.load(_:) Before giving It to AVPlayer via AVPlayerItem with no success :/ Does anyone is facing this error too ? Or is It a bug from the SDK ?
2
2
1.9k
Apr ’24