blob: adaf316302dcc2fea1908fa4394744c2163db7de [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="resources/audio-testing.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Test ensuring silence is output after <audio> playback ended.");
let context = 0;
const sampleRate = 44100.0;
const lengthInSeconds = 3;
function ended() {
context.startRendering();
context.oncomplete = finishAudioTest;
}
function runTest() {
context = new webkitOfflineAudioContext(2, sampleRate * lengthInSeconds, sampleRate);
audioElement = new Audio();
audioElement.src = "resources/media/128kbps-44khz.mp3";
document.body.appendChild(audioElement);
mediaSource = context.createMediaElementSource(audioElement);
window.audioNode = mediaSource;
mediaSource.connect(context.destination);
audioElement.play();
audioElement.addEventListener("ended", ended, true);
testRunner.waitUntilDone();
}
runTest();
</script>
</body>
</html>