| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>MediaStream Recoder Browser Test (w/ MediaSource)</title> | 4 <title>MediaStream Recoder Browser Test (w/ MediaSource)</title> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <div> Record Real-Time video content browser test.</div> | 7 <div> Record Real-Time video content browser test.</div> |
| 8 <video id="video" autoplay></video> | 8 <video id="video" autoplay></video> |
| 9 <video id="remoteVideo" autoplay></video> | 9 <video id="remoteVideo" autoplay></video> |
| 10 </body> | 10 </body> |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 }) | 531 }) |
| 532 .catch(function(err) { | 532 .catch(function(err) { |
| 533 return failTest(err.toString()); | 533 return failTest(err.toString()); |
| 534 }) | 534 }) |
| 535 .then(function() { | 535 .then(function() { |
| 536 console.log('audioSize', audioSize); | 536 console.log('audioSize', audioSize); |
| 537 reportTestSuccess(); | 537 reportTestSuccess(); |
| 538 }); | 538 }); |
| 539 } | 539 } |
| 540 | 540 |
| 541 | 541 // Tests that MediaRecorder can handle video input with alpha channel. |
| 542 // Tests that MediaRecorder can handle a mid-stream resize of the video input | 542 function testRecordWithTransparency(mimeType) { |
| 543 function testResizeVideoInput(mimeType) { | |
| 544 const ON_DATA_AVAILABLE_THRESHOLD = 10; | 543 const ON_DATA_AVAILABLE_THRESHOLD = 10; |
| 545 const NUMBER_OF_EVENTS_TO_RECORD = 5; | 544 const NUMBER_OF_EVENTS_TO_RECORD = 5; |
| 546 | 545 |
| 547 var canvas = document.createElement('canvas'); | 546 var canvas = document.createElement('canvas'); |
| 548 canvas.width = canvas.height = 64; | 547 canvas.width = canvas.height = 64; |
| 549 var stream = canvas.captureStream(); | 548 var stream = canvas.captureStream(); |
| 550 assertTrue(stream, 'Error creating MediaStream'); | 549 assertTrue(stream, 'Error creating MediaStream'); |
| 551 assertEquals(1, stream.getVideoTracks().length); | 550 assertEquals(1, stream.getVideoTracks().length); |
| 552 assertEquals(0, stream.getAudioTracks().length); | 551 assertEquals(0, stream.getAudioTracks().length); |
| 553 var recordedEvents = 0; | 552 var recordedEvents = 0; |
| 554 | 553 |
| 555 function drawOnCanvas(canvas) { | 554 function drawOnCanvas(canvas) { |
| 556 var ctx = canvas.getContext('2d'); | 555 var ctx = canvas.getContext('2d', {alpha: true}); |
| 557 ctx.fillStyle = 'green'; | 556 ctx.fillStyle = 'green'; |
| 558 ctx.fillRect(0, 0, canvas.width, canvas.height); | 557 ctx.fillRect(0, 0, canvas.width, canvas.height); |
| 559 requestAnimationFrame( function() { drawOnCanvas(canvas); }); | 558 requestAnimationFrame( function() { drawOnCanvas(canvas); }); |
| 560 } | 559 } |
| 561 | 560 |
| 562 createMediaRecorder(stream, mimeType) | 561 createMediaRecorder(stream, mimeType) |
| 563 .then(function(recorder) { | 562 .then(function(recorder) { |
| 564 recorder.ondataavailable = function(event) { | 563 recorder.ondataavailable = function(event) { |
| 565 if (event.data.size > ON_DATA_AVAILABLE_THRESHOLD) | 564 if (event.data.size > ON_DATA_AVAILABLE_THRESHOLD) |
| 566 ++recordedEvents; | 565 ++recordedEvents; |
| 567 }; | 566 }; |
| 568 recorder.start(0); | 567 recorder.start(0); |
| 569 drawOnCanvas(canvas); | 568 drawOnCanvas(canvas); |
| 570 }) | 569 }) |
| 571 .then(function() { | 570 .then(function() { |
| 572 return waitFor('Make sure the recording has data', | 571 return waitFor('Make sure the recording has data', |
| 573 function() { | 572 function() { |
| 574 return recordedEvents > NUMBER_OF_EVENTS_TO_RECORD; | 573 return recordedEvents > NUMBER_OF_EVENTS_TO_RECORD; |
| 575 }); | 574 }); |
| 576 }) | 575 }) |
| 577 .then(function() { | |
| 578 canvas.width = canvas.height = 48; | |
| 579 recordedEvents = 0; | |
| 580 }) | |
| 581 .then(function() { | |
| 582 return waitFor('Make sure the recording has data', | |
| 583 function() { | |
| 584 return recordedEvents > NUMBER_OF_EVENTS_TO_RECORD; | |
| 585 }); | |
| 586 }) | |
| 587 .catch(function(err) { | 576 .catch(function(err) { |
| 588 return failTest(err.toString()); | 577 return failTest(err.toString()); |
| 589 }) | 578 }) |
| 590 .then(function() { | 579 .then(function() { |
| 591 reportTestSuccess(); | 580 reportTestSuccess(); |
| 592 }); | 581 }); |
| 593 } | 582 } |
| 594 | 583 |
| 595 // Tests that MediaRecorder's requestData() throws an exception if |state| is | 584 // Tests that MediaRecorder's requestData() throws an exception if |state| is |
| 596 // 'inactive'. | 585 // 'inactive'. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 return failTest(err.toString()); | 654 return failTest(err.toString()); |
| 666 }) | 655 }) |
| 667 .then(function() { | 656 .then(function() { |
| 668 reportTestSuccess(); | 657 reportTestSuccess(); |
| 669 }); | 658 }); |
| 670 } | 659 } |
| 671 | 660 |
| 672 </script> | 661 </script> |
| 673 </body> | 662 </body> |
| 674 </html> | 663 </html> |
| OLD | NEW |