| 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: ' + e.stream.id + |
| 207 '; looking up corresponding video tag.'); | 207 '; looking up corresponding video tag.'); |
| 208 | 208 |
| 209 var remoteVideo = $(e.stream.label); | 209 var remoteVideo = $(e.stream.id); |
| 210 if (!remoteVideo) { | 210 if (!remoteVideo) { |
| 211 // All streams we receive must have a corresponding video tag defined in the | 211 // All streams we receive must have a corresponding video tag defined in the |
| 212 // html, otherwise we can't detect video in it. | 212 // html, otherwise we can't detect video in it. |
| 213 throw 'Received video with unexpected id ' + e.stream.label; | 213 throw 'Received video with unexpected id ' + e.stream.id; |
| 214 } | 214 } |
| 215 remoteVideo.src = webkitURL.createObjectURL(e.stream); | 215 remoteVideo.src = webkitURL.createObjectURL(e.stream); |
| 216 } | 216 } |
| 217 | 217 |
| 218 function onClientIceCandidate(event) { | 218 function onClientIceCandidate(event) { |
| 219 if (event.candidate) { | 219 if (event.candidate) { |
| 220 pcServer.addIceCandidate(event.candidate); | 220 pcServer.addIceCandidate(event.candidate); |
| 221 trace('Local ICE candidate:\n' + event.candidate.candidate); | 221 trace('Local ICE candidate:\n' + event.candidate.candidate); |
| 222 } | 222 } |
| 223 } | 223 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 234 throw 'Expected to run in an automated context.'; | 234 throw 'Expected to run in an automated context.'; |
| 235 window.domAutomationController.send(message); | 235 window.domAutomationController.send(message); |
| 236 } | 236 } |
| 237 | 237 |
| 238 $ = function(id) { | 238 $ = function(id) { |
| 239 return document.getElementById(id); | 239 return document.getElementById(id); |
| 240 }; | 240 }; |
| 241 | 241 |
| 242 </script> | 242 </script> |
| 243 </body> | 243 </body> |
| OLD | NEW |