| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script type="text/javascript"> | 3 <script type="text/javascript"> |
| 4 $ = function(id) { | 4 $ = function(id) { |
| 5 return document.getElementById(id); | 5 return document.getElementById(id); |
| 6 }; | 6 }; |
| 7 | 7 |
| 8 // These must match with how the video and canvas tags are declared in html. | 8 // These must match with how the video and canvas tags are declared in html. |
| 9 const VIDEO_TAG_WIDTH = 320; | 9 const VIDEO_TAG_WIDTH = 320; |
| 10 const VIDEO_TAG_HEIGHT = 240; | 10 const VIDEO_TAG_HEIGHT = 240; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 if (gSentTones == tones) { | 102 if (gSentTones == tones) { |
| 103 clearInterval(waitDtmf); | 103 clearInterval(waitDtmf); |
| 104 eventOccured(); | 104 eventOccured(); |
| 105 } | 105 } |
| 106 }, 100); | 106 }, 100); |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Do the DTMF test after we have received video. | 109 // Do the DTMF test after we have received video. |
| 110 detectVideoIn('remote-view-2', onCallEstablished); | 110 detectVideoIn('remote-view-2', onCallEstablished); |
| 111 } | 111 } |
| 112 |
| 113 // Test call with a new Video MediaStream that has been created based on a |
| 114 // stream generated by getUserMedia. |
| 115 function callWithNewVideoMediaStream() { |
| 116 createConnections(null); |
| 117 navigator.webkitGetUserMedia({audio:true, video:true}, |
| 118 createNewVideoStreamAndAddToBothConnections, printGetUserMediaError); |
| 119 waitForVideo('remote-view-1'); |
| 120 waitForVideo('remote-view-2'); |
| 121 } |
| 112 | 122 |
| 113 // This function is used for setting up a test that: | 123 // This function is used for setting up a test that: |
| 114 // 1. Creates a data channel on |gFirstConnection| and sends data to | 124 // 1. Creates a data channel on |gFirstConnection| and sends data to |
| 115 // |gSecondConnection|. | 125 // |gSecondConnection|. |
| 116 // 2. When data is received on |gSecondConnection| a message | 126 // 2. When data is received on |gSecondConnection| a message |
| 117 // is sent to |gFirstConnection|. | 127 // is sent to |gFirstConnection|. |
| 118 // 3. When data is received on |gFirstConnection|, the data | 128 // 3. When data is received on |gFirstConnection|, the data |
| 119 // channel is closed. The test passes when the state transition completes. | 129 // channel is closed. The test passes when the state transition completes. |
| 120 function setupDataChannel() { | 130 function setupDataChannel() { |
| 121 var sendDataString = "send some text on a data channel." | 131 var sendDataString = "send some text on a data channel." |
| (...skipping 27 matching lines...) Expand all Loading... |
| 149 var secondDataChannel = event.channel; | 159 var secondDataChannel = event.channel; |
| 150 | 160 |
| 151 // When |secondDataChannel| receive a message, send a message back. | 161 // When |secondDataChannel| receive a message, send a message back. |
| 152 secondDataChannel.onmessage = function(event) { | 162 secondDataChannel.onmessage = function(event) { |
| 153 expectEquals(event.data, sendDataString); | 163 expectEquals(event.data, sendDataString); |
| 154 expectEquals('open', secondDataChannel.readyState); | 164 expectEquals('open', secondDataChannel.readyState); |
| 155 secondDataChannel.send(sendDataString); | 165 secondDataChannel.send(sendDataString); |
| 156 } | 166 } |
| 157 } | 167 } |
| 158 } | 168 } |
| 169 |
| 159 | 170 |
| 160 function onToneChange(tone) { | 171 function onToneChange(tone) { |
| 161 gSentTones += tone.tone; | 172 gSentTones += tone.tone; |
| 162 document.title = gSentTones; | 173 document.title = gSentTones; |
| 163 } | 174 } |
| 164 | 175 |
| 165 function createConnections(constraints) { | 176 function createConnections(constraints) { |
| 166 gFirstConnection = new webkitRTCPeerConnection(null, constraints); | 177 gFirstConnection = new webkitRTCPeerConnection(null, constraints); |
| 167 gFirstConnection.onicecandidate = onIceCandidateToFirst; | 178 gFirstConnection.onicecandidate = onIceCandidateToFirst; |
| 168 gFirstConnection.onaddstream = function(event) { | 179 gFirstConnection.onaddstream = function(event) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 196 gSecondConnection.addStream(localStream); | 207 gSecondConnection.addStream(localStream); |
| 197 negotiate(); | 208 negotiate(); |
| 198 } | 209 } |
| 199 | 210 |
| 200 // Called if getUserMedia succeeds when we want to send from one connection. | 211 // Called if getUserMedia succeeds when we want to send from one connection. |
| 201 function addStreamToTheFirstConnectionAndNegotiate(localStream) { | 212 function addStreamToTheFirstConnectionAndNegotiate(localStream) { |
| 202 displayAndRemember(localStream); | 213 displayAndRemember(localStream); |
| 203 gFirstConnection.addStream(localStream); | 214 gFirstConnection.addStream(localStream); |
| 204 negotiate(); | 215 negotiate(); |
| 205 } | 216 } |
| 217 |
| 218 // Called if getUserMedia succeeds when we want to send a modified |
| 219 // MediaStream. A new MediaStream is created and the video track from |
| 220 // |localStream| is added. |
| 221 function createNewVideoStreamAndAddToBothConnections(localStream) { |
| 222 var new_stream = new webkitMediaStream(localStream.getAudioTracks()); |
| 223 new_stream.addTrack(localStream.getVideoTracks()[0]); |
| 224 new_stream.removeTrack(new_stream.getAudioTracks()[0]); |
| 225 addStreamToBothConnectionsAndNegotiate(new_stream); |
| 226 } |
| 206 | 227 |
| 207 function negotiate() { | 228 function negotiate() { |
| 208 gFirstConnection.createOffer(onOfferCreated); | 229 gFirstConnection.createOffer(onOfferCreated); |
| 209 } | 230 } |
| 210 | 231 |
| 211 function onOfferCreated(offer) { | 232 function onOfferCreated(offer) { |
| 212 gFirstConnection.setLocalDescription(offer); | 233 gFirstConnection.setLocalDescription(offer); |
| 213 expectEquals('have-local-offer', gFirstConnection.signalingState); | 234 expectEquals('have-local-offer', gFirstConnection.signalingState); |
| 214 receiveOffer(offer.sdp); | 235 receiveOffer(offer.sdp); |
| 215 } | 236 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 autoplay="autoplay"></video></td> | 374 autoplay="autoplay"></video></td> |
| 354 <!-- Canvases are named after their corresponding video elements. --> | 375 <!-- Canvases are named after their corresponding video elements. --> |
| 355 <td><canvas width="320" height="240" id="remote-view-1-canvas" | 376 <td><canvas width="320" height="240" id="remote-view-1-canvas" |
| 356 style="display:none"></canvas></td> | 377 style="display:none"></canvas></td> |
| 357 <td><canvas width="320" height="240" id="remote-view-2-canvas"> | 378 <td><canvas width="320" height="240" id="remote-view-2-canvas"> |
| 358 style="display:none"></canvas></td> | 379 style="display:none"></canvas></td> |
| 359 </tr> | 380 </tr> |
| 360 </table> | 381 </table> |
| 361 </body> | 382 </body> |
| 362 </html> | 383 </html> |
| OLD | NEW |