OLD | NEW |
1 /** | 1 /** |
2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /** | 7 /** |
8 * See http://dev.w3.org/2011/webrtc/editor/getusermedia.html for more | 8 * See http://dev.w3.org/2011/webrtc/editor/getusermedia.html for more |
9 * information on getUserMedia. See | 9 * information on getUserMedia. See |
10 * http://dev.w3.org/2011/webrtc/editor/webrtc.html for more information on | 10 * http://dev.w3.org/2011/webrtc/editor/webrtc.html for more information on |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 // Trigger global.dataStatusCallback so an application is notified | 974 // Trigger global.dataStatusCallback so an application is notified |
975 // about the created data channel. | 975 // about the created data channel. |
976 onDataChannelReadyStateChange_(); | 976 onDataChannelReadyStateChange_(); |
977 } | 977 } |
978 | 978 |
979 /** @private */ | 979 /** @private */ |
980 function onDataChannelReadyStateChange_() { | 980 function onDataChannelReadyStateChange_() { |
981 var readyState = global.dataChannel.readyState; | 981 var readyState = global.dataChannel.readyState; |
982 print_('DataChannel state:' + readyState); | 982 print_('DataChannel state:' + readyState); |
983 global.dataStatusCallback(readyState); | 983 global.dataStatusCallback(readyState); |
| 984 // Display dataChannel.id only when dataChannel is active/open. |
| 985 if (global.dataChannel.readyState == 'open') { |
| 986 $('data-channel-id').value = global.dataChannel.id; |
| 987 } else if (global.dataChannel.readyState == 'closed') { |
| 988 $('data-channel-id').value = ''; |
| 989 } |
984 } | 990 } |
985 | 991 |
986 /** | 992 /** |
987 * @private | 993 * @private |
988 * @param {MediaStream} stream Media stream. | 994 * @param {MediaStream} stream Media stream. |
989 */ | 995 */ |
990 function getUserMediaOkCallback_(stream) { | 996 function getUserMediaOkCallback_(stream) { |
991 global.localStream = stream; | 997 global.localStream = stream; |
992 global.requestWebcamAndMicrophoneResult = 'ok-got-stream'; | 998 global.requestWebcamAndMicrophoneResult = 'ok-got-stream'; |
993 success_('getUserMedia'); | 999 success_('getUserMedia'); |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 | 1396 |
1391 /** @private */ | 1397 /** @private */ |
1392 function readResponseHeader_(request, key) { | 1398 function readResponseHeader_(request, key) { |
1393 var value = request.getResponseHeader(key); | 1399 var value = request.getResponseHeader(key); |
1394 if (value == null || value.length == 0) { | 1400 if (value == null || value.length == 0) { |
1395 error_('Received empty value ' + value + | 1401 error_('Received empty value ' + value + |
1396 ' for response header key ' + key + '.'); | 1402 ' for response header key ' + key + '.'); |
1397 } | 1403 } |
1398 return parseInt(value); | 1404 return parseInt(value); |
1399 } | 1405 } |
OLD | NEW |