简体   繁体   中英

How to detect whether a webm file is audio or video?

I am building an uploader with ReactJS. When a user uploads a video or audio file, I take the MIME files and register the type (video or audio) to display icons later on.

I have a problem when they upload audio files with the extension webm (music.webm) and the MIME type is video/webm , so I register it as video, when in fact I should register it as audio.

I have tried to decode the video and find some codec to be sure that there is no video using blob.text() , but I can't find the information, or I don't know where to look.

I know it is possible, because the player knows the difference.

How can I detect whether a webm file is audio or video?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM