Reputation: 1506
let vidWidth = asset?.naturalSize()?.width
let vidHeight = asset?.naturalSize()?.height
I'm getting:
Type of expression is ambiguous without a type annotation
How to do this correctly?
What I've tried:
let vidWidth: CGFloat = asset?.naturalSize()?.width
let vidHeight: CGFloat = asset?.naturalSize()?.height
but I'm still getting the same error
Upvotes: 0
Views: 53
Reputation: 100533
As stated Here naturalSize
is deprectaed from AVAsset , you need to use load(.naturalSize)
of AVAssetTrack
Task {
do {
let asset:AVAsset? = nil // For testing purposes
let size = try await asset?.load(.tracks).first?.load(.naturalSize)
print(size?.width)
print(size?.height)
}
catch {
print(error)
}
}
Upvotes: 0