mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-09-10 11:54:40 +00:00
48 lines
1.2 KiB
HTML
48 lines
1.2 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test MediaRecorder Record Stopped Stream</title>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
</head>
|
|
<body>
|
|
<pre id="test">
|
|
<div id="content" style="display: none">
|
|
<audio id="testAudio"></audio>
|
|
</div>
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
function startTest() {
|
|
navigator.mozGetUserMedia({audio: true, fake: true}, function(stream) {
|
|
var testAudio = document.getElementById('testAudio');
|
|
|
|
testAudio.onended = function() {
|
|
var mediaRecorder = new MediaRecorder(stream);
|
|
try {
|
|
mediaRecorder.start();
|
|
ok(false, 'Recording a stopped stream failed to throw an exception');
|
|
} catch (e) {
|
|
is(e.name, 'InvalidStateError',
|
|
'Recording a stopped stream threw an InvalidStateError');
|
|
} finally {
|
|
SimpleTest.finish();
|
|
}
|
|
};
|
|
|
|
testAudio.mozSrcObject = stream;
|
|
testAudio.play();
|
|
stream.stop();
|
|
}, function(err) {
|
|
ok(false, 'Unexpected error fired with: ' + err);
|
|
SimpleTest.finish();
|
|
});
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
startTest();
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|
|
|