61 lines
2.1 KiB
HTML
61 lines
2.1 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Testing concurrent video playing</title>
|
|
<script src="../resources/testharness.js"></script>
|
|
<script src="../resources/testharnessreport.js"></script>
|
|
<script src="../media/media-file.js"></script>
|
|
</head>
|
|
<body>
|
|
<video id="video1" autoplay controls></video>
|
|
<video id="video2" autoplay controls></video>
|
|
<video id="video3" autoplay controls></video>
|
|
<script src ="routines.js"></script>
|
|
<script>
|
|
promise_test(async (test) => {
|
|
if (window.testRunner)
|
|
testRunner.setUserMediaPermission(true);
|
|
|
|
localStream = await navigator.mediaDevices.getUserMedia({audio: true, video: true});
|
|
|
|
const remoteStream = await new Promise((resolve, reject) => {
|
|
createConnections((firstConnection) => {
|
|
firstConnection.addTrack(localStream.getVideoTracks()[0], localStream);
|
|
firstConnection.addTrack(localStream.getAudioTracks()[0], localStream);
|
|
}, (secondConnection) => {
|
|
secondConnection.ontrack = (trackEvent) => {
|
|
resolve(trackEvent.streams[0]);
|
|
};
|
|
});
|
|
setTimeout(() => reject("Test timed out"), 5000);
|
|
});
|
|
|
|
video1.srcObject = localStream;
|
|
video2.srcObject = remoteStream;
|
|
}, "Basic audio/video exchange");
|
|
|
|
promise_test(async (test) => {
|
|
await video1.play();
|
|
await video2.play();
|
|
|
|
assert_false(video1.paused, "video1 paused");
|
|
assert_false(video2.paused, "video2 paused");
|
|
}, "Play MediaStream backed streams concurrently");
|
|
|
|
promise_test(async (test) => {
|
|
|
|
if (window.internals)
|
|
internals.setMediaSessionRestrictions('videoaudio', 'ConcurrentPlaybackNotPermitted');
|
|
|
|
video3.src = findMediaFile('video', '../media/content/audio-tracks');
|
|
await video3.play();
|
|
|
|
assert_false(video1.paused, "video1 paused");
|
|
assert_false(video2.paused, "video2 paused");
|
|
assert_false(video3.paused, "video3 paused");
|
|
}, "Play regular video content should not pause MediaStream backed video elements");
|
|
</script>
|
|
</body>
|
|
</html>
|