4 <title>Adding a track to an inactive MediaStream
</title>
5 <link rel=
"author" title=
"Dominique Hazael-Massieux" href=
"mailto:dom@w3.org"/>
6 <link rel=
"help" href=
"http://w3c.github.io/mediacapture-main/getusermedia.html#widl-MediaStream-addTrack-void-MediaStreamTrack-track">
7 <link rel=
"help" href=
"http://w3c.github.io/mediacapture-main/getusermedia.html#widl-MediaStreamTrack-stop-void">
10 <p class=
"instructions">When prompted, accept to share your audio stream, then
11 your video stream.
</p>
12 <h1 class=
"instructions">Description
</h1>
13 <p class=
"instructions">This test checks that adding a track to an inactive
14 MediaStream is allowed.
</p>
17 <script src=/resources/testharness.js
></script>
18 <script src=/resources/testharnessreport.js
></script>
20 var t
= async_test("Tests that adding a track to an inactive MediaStream is allowed");
24 navigator
.mediaDevices
.getUserMedia({audio
:true}).then(gotAudio
);
25 function gotAudio(stream
) {
27 navigator
.mediaDevices
.getUserMedia({video
:true}).then(gotVideo
);
30 function gotVideo(stream
) {
33 audio
.getAudioTracks()[0].stop();
34 assert_false(audio
.active
, "audio stream is inactive after stopping its only audio track");
35 assert_true(video
.active
, "video stream is active");
36 audio
.addTrack(video
.getVideoTracks()[0]);
37 audio
.removeTrack(audio
.getAudioTracks()[0]);