Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Side by Side Diff: content/test/data/media/peerconnection-call.html

Issue 2365883002: Expose the MediaStream interface (Closed)
Patch Set: drop TODO Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" src="webrtc_test_common.js"></script> 4 <script type="text/javascript" src="webrtc_test_common.js"></script>
5 <script type="text/javascript"> 5 <script type="text/javascript">
6 $ = function(id) { 6 $ = function(id) {
7 return document.getElementById(id); 7 return document.getElementById(id);
8 }; 8 };
9 9
10 window.onerror = function(errorMsg, url, lineNumber, column, errorObj) { 10 window.onerror = function(errorMsg, url, lineNumber, column, errorObj) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // stream using the remote audio and video tracks, connect the new media 127 // stream using the remote audio and video tracks, connect the new media
128 // stream to a video element. These operations should not crash Chrome. 128 // stream to a video element. These operations should not crash Chrome.
129 function ConnectChromiumSinkToRemoteAudioTrack() { 129 function ConnectChromiumSinkToRemoteAudioTrack() {
130 createConnections(null); 130 createConnections(null);
131 navigator.webkitGetUserMedia({audio: true, video: true}, 131 navigator.webkitGetUserMedia({audio: true, video: true},
132 addStreamToBothConnectionsAndNegotiate, 132 addStreamToBothConnectionsAndNegotiate,
133 printGetUserMediaError); 133 printGetUserMediaError);
134 134
135 detectVideoPlaying('remote-view-2', function() { 135 detectVideoPlaying('remote-view-2', function() {
136 // Construct a new media stream with remote tracks. 136 // Construct a new media stream with remote tracks.
137 var newStream = new webkitMediaStream(); 137 var newStream = new MediaStream();
138 newStream.addTrack( 138 newStream.addTrack(
139 gSecondConnection.getRemoteStreams()[0].getAudioTracks()[0]); 139 gSecondConnection.getRemoteStreams()[0].getAudioTracks()[0]);
140 newStream.addTrack( 140 newStream.addTrack(
141 gSecondConnection.getRemoteStreams()[0].getVideoTracks()[0]); 141 gSecondConnection.getRemoteStreams()[0].getVideoTracks()[0]);
142 var videoElement = document.createElement('video'); 142 var videoElement = document.createElement('video');
143 143
144 // No crash for this operation. 144 // No crash for this operation.
145 videoElement.src = URL.createObjectURL(newStream); 145 videoElement.src = URL.createObjectURL(newStream);
146 waitForVideo('remote-view-2'); 146 waitForVideo('remote-view-2');
147 }); 147 });
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 440
441 // Called if getUserMedia succeeds, then clone the stream, send two streams 441 // Called if getUserMedia succeeds, then clone the stream, send two streams
442 // from one peer connection. 442 // from one peer connection.
443 function cloneStreamAndAddTwoStreamsToOneConnection(localStream) { 443 function cloneStreamAndAddTwoStreamsToOneConnection(localStream) {
444 displayAndRemember(localStream); 444 displayAndRemember(localStream);
445 445
446 var clonedStream = null; 446 var clonedStream = null;
447 if (typeof localStream.clone === "function") { 447 if (typeof localStream.clone === "function") {
448 clonedStream = localStream.clone(); 448 clonedStream = localStream.clone();
449 } else { 449 } else {
450 clonedStream = new webkitMediaStream(localStream); 450 clonedStream = new MediaStream(localStream);
451 } 451 }
452 452
453 gFirstConnection.addStream(localStream); 453 gFirstConnection.addStream(localStream);
454 gFirstConnection.addStream(clonedStream); 454 gFirstConnection.addStream(clonedStream);
455 455
456 // Verify the local streams are correct. 456 // Verify the local streams are correct.
457 assertEquals(2, gFirstConnection.getLocalStreams().length); 457 assertEquals(2, gFirstConnection.getLocalStreams().length);
458 verifyHasOneAudioAndVideoTrack(gFirstConnection.getLocalStreams()[0]); 458 verifyHasOneAudioAndVideoTrack(gFirstConnection.getLocalStreams()[0]);
459 verifyHasOneAudioAndVideoTrack(gFirstConnection.getLocalStreams()[1]); 459 verifyHasOneAudioAndVideoTrack(gFirstConnection.getLocalStreams()[1]);
460 460
(...skipping 13 matching lines...) Expand all
474 reportTestSuccess(); 474 reportTestSuccess();
475 }); 475 });
476 476
477 negotiate(); 477 negotiate();
478 } 478 }
479 479
480 // A new MediaStream is created with video track from |localStream| and is 480 // A new MediaStream is created with video track from |localStream| and is
481 // added to both peer connections. 481 // added to both peer connections.
482 function createNewVideoStreamAndAddToBothConnections(localStream) { 482 function createNewVideoStreamAndAddToBothConnections(localStream) {
483 displayAndRemember(localStream); 483 displayAndRemember(localStream);
484 var newStream = new webkitMediaStream(); 484 var newStream = new MediaStream();
485 newStream.addTrack(localStream.getVideoTracks()[0]); 485 newStream.addTrack(localStream.getVideoTracks()[0]);
486 gFirstConnection.addStream(newStream); 486 gFirstConnection.addStream(newStream);
487 gSecondConnection.addStream(newStream); 487 gSecondConnection.addStream(newStream);
488 negotiate(); 488 negotiate();
489 } 489 }
490 490
491 function negotiate() { 491 function negotiate() {
492 negotiateBetween(gFirstConnection, gSecondConnection); 492 negotiateBetween(gFirstConnection, gSecondConnection);
493 } 493 }
494 494
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 <td><canvas width="320" height="240" id="remote-view-2-canvas" 620 <td><canvas width="320" height="240" id="remote-view-2-canvas"
621 style="display:none"></canvas></td> 621 style="display:none"></canvas></td>
622 <td><canvas width="320" height="240" id="remote-view-3-canvas" 622 <td><canvas width="320" height="240" id="remote-view-3-canvas"
623 style="display:none"></canvas></td> 623 style="display:none"></canvas></td>
624 <td><canvas width="320" height="240" id="remote-view-4-canvas" 624 <td><canvas width="320" height="240" id="remote-view-4-canvas"
625 style="display:none"></canvas></td> 625 style="display:none"></canvas></td>
626 </tr> 626 </tr>
627 </table> 627 </table>
628 </body> 628 </body>
629 </html> 629 </html>
OLDNEW
« no previous file with comments | « content/test/data/media/getusermedia.html ('k') | ppapi/examples/video_effects/video_effects.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698