Is there a way to validate the length of webcam/screen recording?

Hi, I’m uploading video to my web server via XHR upload and I’m trying to ensure that users that record their webcam or their screen only record clips that are between 5 and 60 seconds long. For uploaded files, I’m using getID3() to retrieve the duration of the uploaded video so that I can return an error when the video is too short or too long. This works perfectly for uploaded videos, but because video and screen recordings use .webm files this method doesn’t work. I’ve tried to change the preferred mime type to .mp4 but every time I record it seems to upload a .webm. I need to know if there’s an easier way to do this. Any help would be greatly appreciated. Thanks.