I am making a static html page that is fetches for somewhere between six and thirty files with fetch. I am going to implement code that sorts the files by content type later, but what is important to me right now is detect if the files that are videos have sound or not. I don't know how to do this. For speed purposes, I only fetch the responses HEAD. Here is what I have so far:
//links is an array of values that are the urls to the videos
links.forEach(function(item, index) {
var requestplace = new Request(item);
fetch(requestplace, {method: 'HEAD'}).then(function(response) {
if (response.ok) {
var ctype = response.headers.get("Content-Type")
console.log(`Link #${index + 1}: Url:${item} Content-Type: ${ctype}`);
} else {
console.log(`Link #${index + 1}: Url:${item} FAILED!`);
}
});
});
I would like to know if anyone knows how to detect if the response video has sound tracks included with it.
EDIT:
I would prefer if the files were requested with HEAD because it seems that it is the quickest way possible, but it is preferable not necessary.