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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 // Trigger global.dataStatusCallback so an application is notified | 961 // Trigger global.dataStatusCallback so an application is notified |
962 // about the created data channel. | 962 // about the created data channel. |
963 onDataChannelReadyStateChange_(); | 963 onDataChannelReadyStateChange_(); |
964 } | 964 } |
965 | 965 |
966 /** @private */ | 966 /** @private */ |
967 function onDataChannelReadyStateChange_() { | 967 function onDataChannelReadyStateChange_() { |
968 var readyState = global.dataChannel.readyState; | 968 var readyState = global.dataChannel.readyState; |
969 print_('DataChannel state:' + readyState); | 969 print_('DataChannel state:' + readyState); |
970 global.dataStatusCallback(readyState); | 970 global.dataStatusCallback(readyState); |
| 971 // Display dataChannel.id only when dataChannel is active/open. |
| 972 if (global.dataChannel.readyState == 'open') { |
| 973 $('data-channel-id').value = global.dataChannel.id; |
| 974 } else if (global.dataChannel.readyState == 'closed') { |
| 975 $('data-channel-id').value = ''; |
| 976 } |
971 } | 977 } |
972 | 978 |
973 /** | 979 /** |
974 * @private | 980 * @private |
975 * @param {MediaStream} stream Media stream. | 981 * @param {MediaStream} stream Media stream. |
976 */ | 982 */ |
977 function getUserMediaOkCallback_(stream) { | 983 function getUserMediaOkCallback_(stream) { |
978 global.localStream = stream; | 984 global.localStream = stream; |
979 global.requestWebcamAndMicrophoneResult = 'ok-got-stream'; | 985 global.requestWebcamAndMicrophoneResult = 'ok-got-stream'; |
980 success_('getUserMedia'); | 986 success_('getUserMedia'); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 | 1416 |
1411 /** @private */ | 1417 /** @private */ |
1412 function readResponseHeader_(request, key) { | 1418 function readResponseHeader_(request, key) { |
1413 var value = request.getResponseHeader(key); | 1419 var value = request.getResponseHeader(key); |
1414 if (value == null || value.length == 0) { | 1420 if (value == null || value.length == 0) { |
1415 error_('Received empty value ' + value + | 1421 error_('Received empty value ' + value + |
1416 ' for response header key ' + key + '.'); | 1422 ' for response header key ' + key + '.'); |
1417 } | 1423 } |
1418 return parseInt(value); | 1424 return parseInt(value); |
1419 } | 1425 } |
OLD | NEW |