forked from mirrors/gecko-dev
51 lines
1.4 KiB
HTML
51 lines
1.4 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
|
|
<script type="application/javascript" src="blacksilence.js"></script>
|
|
</head>
|
|
<body>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
createHTML({
|
|
title: "Test getUserMedia peerIdentity Constraint",
|
|
bug: "942367"
|
|
});
|
|
async function theTest() {
|
|
async function testPeerIdentityConstraint(withConstraint) {
|
|
const config = { audio: true, video: true };
|
|
if (withConstraint) {
|
|
config.peerIdentity = 'user@example.com';
|
|
}
|
|
info('getting media with constraints: ' + JSON.stringify(config));
|
|
const stream = await getUserMedia(config);
|
|
for (const track of stream.getTracks()) {
|
|
const recorder = new MediaRecorder(new MediaStream([track]));
|
|
try {
|
|
recorder.start();
|
|
ok(!withConstraint,
|
|
`gUM ${track.kind} track without peerIdentity must not throw`);
|
|
recorder.stop();
|
|
} catch(e) {
|
|
ok(withConstraint,
|
|
`gUM ${track.kind} track with peerIdentity must throw`);
|
|
}
|
|
}
|
|
await Promise.all([
|
|
audioIsSilence(withConstraint, stream),
|
|
videoIsBlack(withConstraint, stream),
|
|
]);
|
|
stream.getTracks().forEach(t => t.stop());
|
|
};
|
|
|
|
// both without and with the constraint
|
|
await testPeerIdentityConstraint(false);
|
|
await testPeerIdentityConstraint(true);
|
|
}
|
|
|
|
runTest(theTest);
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|