Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
| 5 <title>WebRTC Simulcast Test</title> | 5 <title>WebRTC Simulcast Test</title> |
| 6 <style> | 6 <style> |
| 7 video { | 7 video { |
| 8 border:5px solid black; | 8 border:5px solid black; |
| 9 } | 9 } |
| 10 button { | 10 button { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 renegotiateClient(); | 159 renegotiateClient(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 function didntGetStream(err) { | 162 function didntGetStream(err) { |
| 163 returnToTest('Unexpectedly failed to acquire user media: ' + err); | 163 returnToTest('Unexpectedly failed to acquire user media: ' + err); |
| 164 } | 164 } |
| 165 | 165 |
| 166 function openCamera(width, height) { | 166 function openCamera(width, height) { |
| 167 if (localStream) { | 167 if (localStream) { |
| 168 pcClient.removeStream(localStream); | 168 pcClient.removeStream(localStream); |
| 169 localStream.getVideoTracks().stop(); | 169 localStream.getVideoTracks()[0].stop(); |
| 170 localStream = null; | 170 localStream = null; |
| 171 } | 171 } |
| 172 navigator.webkitGetUserMedia({ | 172 navigator.webkitGetUserMedia({ |
| 173 audio: false, | 173 audio: false, |
| 174 video: {'mandatory': {'minWidth': width, 'maxWidth': width, | 174 video: {'mandatory': {'minWidth': width, 'maxWidth': width, |
| 175 'minHeight': height, 'maxHeight': height}} | 175 'minHeight': height, 'maxHeight': height}} |
| 176 }, gotStream, didntGetStream); | 176 }, gotStream, didntGetStream); |
| 177 } | 177 } |
| 178 | 178 |
| 179 function renegotiateClient() { | 179 function renegotiateClient() { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 196 | 196 |
| 197 function onServerAnswer(desc) { | 197 function onServerAnswer(desc) { |
| 198 desc.sdp += 'a=x-google-flag:conference\n'; | 198 desc.sdp += 'a=x-google-flag:conference\n'; |
| 199 serverAnswer = desc; | 199 serverAnswer = desc; |
| 200 trace('Setting both Answers to:\n' + desc.sdp); | 200 trace('Setting both Answers to:\n' + desc.sdp); |
| 201 pcServer.setLocalDescription(desc); | 201 pcServer.setLocalDescription(desc); |
| 202 pcClient.setRemoteDescription(desc); | 202 pcClient.setRemoteDescription(desc); |
| 203 } | 203 } |
| 204 | 204 |
| 205 function onServerGotStream(e) { | 205 function onServerGotStream(e) { |
| 206 trace('Received remote stream: ' + e.stream.label + | 206 trace('Received remote stream, looking up corresponding video tag.'); |
| 207 '; looking up corresponding video tag.'); | 207 var remoteVideo = e.stream; |
|
philipj_slow
2015/09/22 09:08:09
I don't get this change, I think remoteVideo is no
shiva.jm
2015/09/23 03:29:51
Yes, right we need to use just e.stream.id instead
| |
| 208 | |
| 209 var remoteVideo = $(e.stream.label); | |
| 210 if (!remoteVideo) { | |
| 211 // All streams we receive must have a corresponding video tag defined in the | |
| 212 // html, otherwise we can't detect video in it. | |
| 213 throw 'Received video with unexpected id ' + e.stream.label; | |
| 214 } | |
| 215 remoteVideo.src = webkitURL.createObjectURL(e.stream); | 208 remoteVideo.src = webkitURL.createObjectURL(e.stream); |
| 216 } | 209 } |
| 217 | 210 |
| 218 function onClientIceCandidate(event) { | 211 function onClientIceCandidate(event) { |
| 219 if (event.candidate) { | 212 if (event.candidate) { |
| 220 pcServer.addIceCandidate(event.candidate); | 213 pcServer.addIceCandidate(event.candidate); |
| 221 trace('Local ICE candidate:\n' + event.candidate.candidate); | 214 trace('Local ICE candidate:\n' + event.candidate.candidate); |
| 222 } | 215 } |
| 223 } | 216 } |
| 224 | 217 |
| 225 function onServerIceCandidate(event) { | 218 function onServerIceCandidate(event) { |
| 226 if (event.candidate) { | 219 if (event.candidate) { |
| 227 pcClient.addIceCandidate(event.candidate); | 220 pcClient.addIceCandidate(event.candidate); |
| 228 trace('Remote ICE candidate:\n' + event.candidate.candidate); | 221 trace('Remote ICE candidate:\n' + event.candidate.candidate); |
| 229 } | 222 } |
| 230 } | 223 } |
| 231 | 224 |
| 232 function returnToTest(message) { | 225 function returnToTest(message) { |
| 233 if (!window.domAutomationController) | 226 if (!window.domAutomationController) |
| 234 throw 'Expected to run in an automated context.'; | 227 throw 'Expected to run in an automated context.'; |
| 235 window.domAutomationController.send(message); | 228 window.domAutomationController.send(message); |
| 236 } | 229 } |
| 237 | 230 |
| 238 $ = function(id) { | 231 $ = function(id) { |
| 239 return document.getElementById(id); | 232 return document.getElementById(id); |
| 240 }; | 233 }; |
| 241 | 234 |
| 242 </script> | 235 </script> |
| 243 </body> | 236 </body> |
| OLD | NEW |