I'm using a PHPickerViewController
to allow the user to select a media item from their library. And the specific case of interest is when they select a video.
I get a callback on the PHPickerViewControllerDelegate
delegate method:
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult])
And I'm using loadFileRepresentation
to get the video from the NSItemProvider
.
However, that call takes a substantial amount of time. And it may be all for nothing -- since I'm imposing a size limit on the videos that users can add to the app.
So, my question is: Is there a way to determine, quickly, the size of the media item that the user has selected? E.g., given the NSItemProvider
?