소스 검색

style(JitsiLocalTrack):Rename method & add comment

dev1
Hristo Terezov 6 년 전
부모
커밋
1bfc96a287
1개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 6
    3
      modules/RTC/JitsiLocalTrack.js

+ 6
- 3
modules/RTC/JitsiLocalTrack.js 파일 보기

147
          */
147
          */
148
         this._noDataFromSourceTimeout = null;
148
         this._noDataFromSourceTimeout = null;
149
 
149
 
150
-        this._onDeviceListChanged = devices => {
150
+        this._onDeviceListWillChange = devices => {
151
             this._setRealDeviceIdFromDeviceList(devices);
151
             this._setRealDeviceIdFromDeviceList(devices);
152
 
152
 
153
             // Mark track as ended for those browsers that do not support
153
             // Mark track as ended for those browsers that do not support
171
                 this._onAudioOutputDeviceChanged);
171
                 this._onAudioOutputDeviceChanged);
172
         }
172
         }
173
 
173
 
174
-        RTCUtils.addListener(RTCEvents.DEVICE_LIST_WILL_CHANGE, this._onDeviceListChanged);
174
+        RTCUtils.addListener(RTCEvents.DEVICE_LIST_WILL_CHANGE, this._onDeviceListWillChange);
175
 
175
 
176
         this._initNoDataFromSourceHandlers();
176
         this._initNoDataFromSourceHandlers();
177
     }
177
     }
269
         let device = devices.find(d => d.kind === kind && d.label === track.label);
269
         let device = devices.find(d => d.kind === kind && d.label === track.label);
270
 
270
 
271
         if (!device && this._realDeviceId === 'default') { // the default device has been changed.
271
         if (!device && this._realDeviceId === 'default') { // the default device has been changed.
272
+            // If the default device was 'A' and the default device is changed to 'B' the label for the track will
273
+            // remain 'Default - A' but the label for the device in the device list will be updated to 'A'. That's
274
+            // why in order to match it we need to remove the 'Default - ' part.
272
             const label = (track.label || '').replace('Default - ', '');
275
             const label = (track.label || '').replace('Default - ', '');
273
 
276
 
274
             device = devices.find(d => d.kind === kind && d.label === label);
277
             device = devices.find(d => d.kind === kind && d.label === label);
525
             this.detach();
528
             this.detach();
526
         }
529
         }
527
 
530
 
528
-        RTCUtils.removeListener(RTCEvents.DEVICE_LIST_WILL_CHANGE, this._onDeviceListChanged);
531
+        RTCUtils.removeListener(RTCEvents.DEVICE_LIST_WILL_CHANGE, this._onDeviceListWillChange);
529
 
532
 
530
         if (this._onAudioOutputDeviceChanged) {
533
         if (this._onAudioOutputDeviceChanged) {
531
             RTCUtils.removeListener(RTCEvents.AUDIO_OUTPUT_DEVICE_CHANGED,
534
             RTCUtils.removeListener(RTCEvents.AUDIO_OUTPUT_DEVICE_CHANGED,

Loading…
취소
저장