зеркало из https://github.com/mozilla/gecko-dev.git
36 строки
912 B
HTML
36 строки
912 B
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
|
|
</head>
|
|
<body>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
createHTML({
|
|
title: "navigator.mozGetUserMedia Callback Test",
|
|
bug: "1119593"
|
|
});
|
|
/**
|
|
* Check that the old fashioned callback-based function works.
|
|
*/
|
|
runTest(function () {
|
|
var testAudio = createMediaElement('audio', 'testAudio');
|
|
var constraints = {audio: true};
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
return new Promise(resolve =>
|
|
navigator.mozGetUserMedia(constraints, stream => {
|
|
checkMediaStreamTracks(constraints, stream);
|
|
|
|
var playback = new LocalMediaStreamPlayback(testAudio, stream);
|
|
return playback.playMedia(false)
|
|
.then(() => resolve(), generateErrorCallback());
|
|
}, generateErrorCallback())
|
|
);
|
|
});
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|