blob: 8699147af07499de0de775a23e4132d5fa66e6f4 [file] [log] [blame] [edit]
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test.js"></script>
<script type="text/javascript" src="resources/audio-testing.js"></script>
</head>
<body>
<script>
description("Test that decoding an flac file succeeds");
window.jsTestIsAsync = true;
var context = new window.AudioContext({ sampleRate: 48000 });
var request = new XMLHttpRequest();
request.open("GET", 'resources/media/flac.flac', true);
request.responseType = "arraybuffer";
request.onload = function() {
context.decodeAudioData(request.response, (buffer) => {
testPassed("Successfully decoded content");
if (buffer.length === 47688)
testPassed("Decoding returned the right number of frames.");
else
testFailed("Decoding returned the wrong number of frames: " + buffer.length);
finishJSTest();
}, () => {
testFailed("Failed to decode file");
finishJSTest();
});
}
request.send();
</script>
</body>
</html>