H264(AVC) Profile and Level detection.
This module made of WebModule.
<script src="<module-dir>/lib/WebModule.js"></script>
<script src="<module-dir>/lib/H264Profile.js"></script>
<script>
var codecs = "mp4a.40.2, avc1.4d4015";
var codecArray = codecs.split(","); // -> ["mp4a.40.2", " avc1.42c01e"]
for (var i = 0, iz = codecArray.length; i < iz; ++i) {
var codec = codecArray[i].trim();
if (/avc1/.test(codec)) {
console.info( H264Profile.getProfile(codec) ); // -> "Base";
console.info( H264Profile.getLevel(codec) ); // -> "3.0";
}
}
</script>
importScripts("<module-dir>/lib/WebModule.js");
importScripts("<module-dir>/lib/H264Profile.js");
require("<module-dir>/lib/WebModule.js");
require("<module-dir>/lib/H264Profile.js");