'getting video length of mov file with no audio error chrome js

Is there an accurate way to determine the length of a .mov file with chrome? On our website we currently use video.onloadedmetadata but it's causing errors.

Example:

upload(data) {
 const file = data.body.get('file');
 const filename = file.name;

 const video = document.createElement('video');
 video.preload = 'metadata';
 video.onloadedmetadata = () => {
   const videoDuration = Math.floor(video.duration);
 }

 video.onerror = (error) => {
   debugger;
   console.error(error);
 };
};

Image of error:

enter image description here

Edit: Meta data from video file, using command exiftool post_131.1.1.mov > b.txt

ExifTool Version Number         : 12.41
File Name                       : post_131.1.1.mov
Directory                       : .
File Size                       : 2.0 MiB
File Modification Date/Time     : 2022:04:21 15:48:44+10:00
File Access Date/Time           : 2022:04:26 10:14:37+10:00
File Inode Change Date/Time     : 2022:04:26 09:52:14+10:00
File Permissions                : -rw-r--r--
File Type                       : MP4
File Type Extension             : mp4
MIME Type                       : video/mp4
Major Brand                     : MP4 v2 [ISO 14496-14]
Minor Version                   : 0.0.1
Compatible Brands               : isom, mp41, mp42
Movie Header Version            : 0
Create Date                     : 2019:10:26 05:05:31
Modify Date                     : 2019:10:26 05:05:32
Time Scale                      : 600
Duration                        : 5.70 s
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 2
Track Header Version            : 0
Track Create Date               : 2019:10:26 05:05:31
Track Modify Date               : 2019:10:26 05:05:32
Track ID                        : 1
Track Duration                  : 5.70 s
Track Layer                     : 0
Track Volume                    : 0.00%
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Image Width                     : 720
Image Height                    : 1280
Media Header Version            : 0
Media Create Date               : 2019:10:26 05:05:31
Media Modify Date               : 2019:10:26 05:05:32
Media Time Scale                : 600
Media Duration                  : 5.70 s
Media Language Code             : und
Handler Type                    : Video Track
Handler Description             : Core Media Video
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : hvc1
Source Image Width              : 720
Source Image Height             : 1280
X Resolution                    : 72
Y Resolution                    : 72
Bit Depth                       : 24
Color Representation            : nclx 6 1 6
Video Frame Rate                : 20
Media Data Size                 : 2111343
Media Data Offset               : 2466
Image Size                      : 720x1280
Megapixels                      : 0.922
Avg Bitrate                     : 2.96 Mbps
Rotation                        : 0


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source