| <body> |
| <video id="localVideo" autoplay playsInline></video> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="../../media/media-file.js"></script> |
| <script> |
| promise_test(async() => { |
| let stream = await navigator.mediaDevices.getUserMedia({audio : true}); |
| |
| localVideo.srcObject = stream; |
| await localVideo.play(); |
| |
| let cptr = 0; |
| while (++cptr < 20) { |
| localVideo.srcObject = stream; |
| await localVideo.play(); |
| await new Promise(resolve => setTimeout(resolve, 10)); |
| localVideo.src = findMediaFile('video', 'content/test'); |
| await localVideo.play(); |
| await new Promise(resolve => setTimeout(resolve, 10)); |
| } |
| }, "Check switching between playing with and without stream"); |
| |
| promise_test(async() => { |
| let stream = await navigator.mediaDevices.getUserMedia({audio : true, video: true}); |
| |
| localVideo.srcObject = stream; |
| await localVideo.play(); |
| |
| const audioTrack = stream.getAudioTracks()[0]; |
| localVideo.srcObject = stream; |
| await localVideo.play(); |
| |
| let cptr = 0; |
| while (++cptr < 20) { |
| stream.removeTrack(audioTrack); |
| await new Promise(resolve => setTimeout(resolve, 100)); |
| stream.addTrack(audioTrack); |
| await new Promise(resolve => setTimeout(resolve, 100)); |
| } |
| }, "Check adding and removing a track to a stream"); |
| </script> |
| </body> |