<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Creating/deleting an audio receiver without playing it</title>
        <script src="../resources/testharness.js"></script>
        <script src="../resources/testharnessreport.js"></script>
    </head>
    <body>
        <video id="video"></video>
        <script src ="routines.js"></script>
        <script>
promise_test(async (test) => {
    const localStream = await navigator.mediaDevices.getUserMedia({audio: true});
    const stream = await new Promise((resolve, reject) => {
        createConnections((firstConnection) => {
            firstConnection.addTrack(localStream.getAudioTracks()[0], localStream);
        }, (secondConnection) => {
            secondConnection.ontrack = (trackEvent) => {
                resolve(trackEvent.streams[0]);
            };
        });
        setTimeout(() => reject("Test timed out"), 5000);
    });

    video.srcObject = stream;
    await new Promise(resolve => setTimeout(resolve, 10));

    video.srcObject = stream;
    await new Promise(resolve => setTimeout(resolve, 1000));
}, "Create and delete audio renderer without playing it");
        </script>
    </body>
</html>
