2014-02-25 03:50:42 -08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head><meta charset="UTF-8"></head>
|
|
|
|
<body>
|
|
|
|
<div id="message"></div>
|
|
|
|
<script>
|
2014-06-02 07:41:57 -07:00
|
|
|
// Specifies whether we are using fake streams to run this automation
|
|
|
|
var useFakeStreams = true;
|
|
|
|
try {
|
|
|
|
var audioDevice = SpecialPowers.getCharPref("media.audio_loopback_dev");
|
|
|
|
var videoDevice = SpecialPowers.getCharPref("media.video_loopback_dev");
|
|
|
|
dump("TEST DEVICES: Using media devices:\n");
|
|
|
|
dump("audio: " + audioDevice + "\nvideo: " + videoDevice + "\n");
|
|
|
|
useFakeStreams = false;
|
|
|
|
} catch (e) {
|
|
|
|
dump("TEST DEVICES: No test devices found (in media.{audio,video}_loopback_dev, using fake streams.\n");
|
|
|
|
useFakeStreams = true;
|
|
|
|
}
|
|
|
|
|
2014-02-25 03:50:42 -08:00
|
|
|
function message(m) {
|
|
|
|
document.getElementById("message").innerHTML = m;
|
|
|
|
window.parent.postMessage(m, "*");
|
|
|
|
}
|
|
|
|
|
|
|
|
var gStream;
|
|
|
|
|
|
|
|
function requestDevice(aAudio, aVideo) {
|
2014-06-02 07:41:57 -07:00
|
|
|
var opts = {video: aVideo, audio: aAudio};
|
|
|
|
if (useFakeStreams) {
|
|
|
|
opts.fake = true;
|
|
|
|
}
|
|
|
|
window.navigator.mozGetUserMedia(opts, function(stream) {
|
2014-02-25 03:50:42 -08:00
|
|
|
gStream = stream;
|
|
|
|
message("ok");
|
|
|
|
}, function(err) { message("error: " + err); });
|
|
|
|
}
|
|
|
|
message("pending");
|
|
|
|
|
|
|
|
function closeStream() {
|
|
|
|
if (!gStream)
|
|
|
|
return;
|
|
|
|
gStream.stop();
|
|
|
|
gStream = null;
|
|
|
|
message("closed");
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|