OLD | NEW |
---|---|
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> | 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> |
4 <script type="text/javascript"> | 4 <script type="text/javascript"> |
5 $ = function(id) { | 5 $ = function(id) { |
6 return document.getElementById(id); | 6 return document.getElementById(id); |
7 }; | 7 }; |
8 | 8 |
9 setAllEventsOccuredHandler(function() { | 9 setAllEventsOccuredHandler(function() { |
10 reportTestSuccess(); | 10 reportTestSuccess(); |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 return; | 549 return; |
550 } | 550 } |
551 } | 551 } |
552 | 552 |
553 clearInterval(detectorInterval); | 553 clearInterval(detectorInterval); |
554 var result = "w=" + width + ":h=" + height; | 554 var result = "w=" + width + ":h=" + height; |
555 callback(result); | 555 callback(result); |
556 } | 556 } |
557 var detectorInterval = setInterval(detectorFunction, 50); | 557 var detectorInterval = setInterval(detectorFunction, 50); |
558 } | 558 } |
559 | |
560 function srcObjectAddVideoTrack() { | |
561 var video = document.createElement('video'); | |
562 video.autoplay = true; | |
563 assertEquals(video.srcObject, null); | |
564 navigator.mediaDevices.getUserMedia({audio: true, video: true}) | |
565 .then(stream => { | |
566 video.onplaying = function() { | |
567 video.onplaying = null; | |
568 video.onloadstart = function() { | |
569 failTest("loadstart should not be called"); | |
570 } | |
571 | |
572 video.onresize = function() { | |
573 assertNotEquals(video.srcObject, null); | |
574 assertTrue(video.videoHeight > 0); | |
575 assertTrue(video.videoWidth > 0); | |
576 reportTestSuccess(); | |
577 } | |
578 | |
579 assertNotEquals(video.srcObject, null); | |
580 assertEquals(video.videoWidth, 0); | |
581 assertEquals(video.videoHeight, 0); | |
582 video.srcObject.addTrack(stream.getVideoTracks()[0]); | |
583 } | |
584 video.srcObject = new MediaStream(stream.getAudioTracks()); | |
585 }) | |
586 .catch(e => { | |
587 failTest("Unexpected error: " + e) | |
588 }); | |
589 } | |
590 | |
591 function srcObjectRemoveVideoTrack() { | |
592 var video = document.createElement('video'); | |
593 video.autoplay = true; | |
594 assertEquals(video.srcObject, null); | |
595 navigator.mediaDevices.getUserMedia({audio: true, video: true}) | |
596 .then(stream => { | |
597 video.onplaying = function() { | |
598 video.onplaying = null; | |
599 video.onloadstart = function() { | |
600 failTest("loadstart should not be called"); | |
601 } | |
602 | |
603 video.onresize = function() { | |
604 assertNotEquals(video.srcObject, null); | |
605 assertEquals(0, video.videoHeight); | |
606 assertEquals(0, video.videoWidth); | |
607 reportTestSuccess(); | |
608 } | |
609 | |
610 assertNotEquals(video.srcObject, null); | |
611 assertTrue(video.videoWidth > 0); | |
612 assertTrue(video.videoHeight > 0); | |
613 stream.removeTrack(stream.getVideoTracks()[0]); | |
614 } | |
615 video.srcObject = stream; | |
616 }) | |
617 .catch(e => { | |
618 failTest("Unexpected error: " + e) | |
619 }); | |
620 } | |
621 | |
622 function srcObjectReassignSameObject() { | |
foolip
2017/07/05 13:13:52
This would be possible to test in web-platform-tes
| |
623 var video = document.createElement('video'); | |
624 video.autoplay = true; | |
625 assertEquals(video.srcObject, null); | |
626 navigator.mediaDevices.getUserMedia({audio: true, video: true}) | |
627 .then(stream => { | |
628 video.onplaying = function() { | |
629 video.onplaying = null; | |
630 video.onloadstart = function() { | |
631 reportTestSuccess(); | |
632 } | |
633 assertNotEquals(video.srcObject, null); | |
634 assertTrue(video.videoWidth > 0); | |
635 assertTrue(video.videoHeight > 0); | |
636 // Reassigning the same object should trigger the load algorithm. | |
637 video.srcObject = video.srcObject; | |
638 } | |
639 video.srcObject = stream; | |
640 }) | |
641 .catch(e => { | |
642 failTest("Unexpected error: " + e) | |
643 }); | |
644 } | |
559 </script> | 645 </script> |
560 </head> | 646 </head> |
561 <body> | 647 <body> |
562 <table border="0"> | 648 <table border="0"> |
563 <!-- Canvases are named after their corresponding video elements. --> | 649 <!-- Canvases are named after their corresponding video elements. --> |
564 <tr> | 650 <tr> |
565 <td><video id="local-view-1" width="320" height="240" autoplay | 651 <td><video id="local-view-1" width="320" height="240" autoplay |
566 style="display:none"></video></td> | 652 style="display:none"></video></td> |
567 <td><canvas id="local-view-1-canvas" width="320" height="240" | 653 <td><canvas id="local-view-1-canvas" width="320" height="240" |
568 style="display:none"></canvas></td> | 654 style="display:none"></canvas></td> |
569 </tr> | 655 </tr> |
570 <tr> | 656 <tr> |
571 <td><video id="local-view-2" width="320" height="240" autoplay | 657 <td><video id="local-view-2" width="320" height="240" autoplay |
572 style="display:none"></video></td> | 658 style="display:none"></video></td> |
573 <td><canvas id="local-view-2-canvas" width="320" height="240" | 659 <td><canvas id="local-view-2-canvas" width="320" height="240" |
574 style="display:none"></canvas></td> | 660 style="display:none"></canvas></td> |
575 </tr> | 661 </tr> |
576 </table> | 662 </table> |
577 </body> | 663 </body> |
578 </html> | 664 </html> |
OLD | NEW |