I'm trying to limit the size of videos the user is allowed to upload. Is there a native way or workaround to check immediately in PhotosPicker if the user selects a video that exceeds a certain length? For example if we set a limit of 20 seconds, and a user selects a video at 25 seconds, we would trigger an action.
I did achieve this functionality, but only after I stored the video in storage and fetched the URL. It would be great to check this immediately once the user uploads and not have to fetch the URL first in order to achieve this.
There is no built-in way to do this. The picker doesn't hand you a video when the user merely taps on an item to selct it in the picker; in fact, it doesn't hand you anything until the user is finished with the picker (and even then it doesn't hand you any videos — you have to fetch them yourself). If you want a picker where you know what the user is doing while the user is interacting with the picker, you will have to write your own picker, from scratch.