|
@@ -1,10 +1,5 @@
|
1
|
1
|
/* global __filename, Promise */
|
2
|
2
|
|
3
|
|
-import {
|
4
|
|
- _NO_DATA_FROM_SOURCE,
|
5
|
|
- _TRACK_UNMUTE
|
6
|
|
-} from '../../service/statistics/AnalyticsEvents';
|
7
|
|
-import CameraFacingMode from '../../service/RTC/CameraFacingMode';
|
8
|
3
|
import { getLogger } from 'jitsi-meet-logger';
|
9
|
4
|
import JitsiTrack from './JitsiTrack';
|
10
|
5
|
import JitsiTrackError from '../../JitsiTrackError';
|
|
@@ -17,12 +12,17 @@ import {
|
17
|
12
|
NO_DATA_FROM_SOURCE,
|
18
|
13
|
TRACK_MUTE_CHANGED
|
19
|
14
|
} from '../../JitsiTrackEvents';
|
20
|
|
-import * as MediaType from '../../service/RTC/MediaType';
|
21
|
15
|
import RTCBrowserType from './RTCBrowserType';
|
22
|
|
-import RTCEvents from '../../service/RTC/RTCEvents';
|
23
|
16
|
import RTCUtils from './RTCUtils';
|
24
|
|
-import Statistics from '../statistics/statistics';
|
|
17
|
+import CameraFacingMode from '../../service/RTC/CameraFacingMode';
|
|
18
|
+import * as MediaType from '../../service/RTC/MediaType';
|
|
19
|
+import RTCEvents from '../../service/RTC/RTCEvents';
|
25
|
20
|
import VideoType from '../../service/RTC/VideoType';
|
|
21
|
+import {
|
|
22
|
+ _NO_DATA_FROM_SOURCE,
|
|
23
|
+ _TRACK_UNMUTE
|
|
24
|
+} from '../../service/statistics/AnalyticsEvents';
|
|
25
|
+import Statistics from '../statistics/statistics';
|
26
|
26
|
|
27
|
27
|
const logger = getLogger(__filename);
|
28
|
28
|
|
|
@@ -33,6 +33,8 @@ const logger = getLogger(__filename);
|
33
|
33
|
export default class JitsiLocalTrack extends JitsiTrack {
|
34
|
34
|
/**
|
35
|
35
|
* Constructs new JitsiLocalTrack instanse.
|
|
36
|
+ *
|
|
37
|
+ * @constructor
|
36
|
38
|
* @param {Object} trackInfo
|
37
|
39
|
* @param {number} trackInfo.rtcId the ID assigned by the RTC module
|
38
|
40
|
* @param trackInfo.stream WebRTC MediaStream, parent of the track
|
|
@@ -46,7 +48,6 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
46
|
48
|
* call
|
47
|
49
|
* @param {sourceId} trackInfo.sourceId - The id of the desktop sharing
|
48
|
50
|
* source. NOTE: defined for desktop sharing tracks only.
|
49
|
|
- * @constructor
|
50
|
51
|
*/
|
51
|
52
|
constructor({
|
52
|
53
|
deviceId,
|
|
@@ -70,6 +71,7 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
70
|
71
|
|
71
|
72
|
/**
|
72
|
73
|
* The ID assigned by the RTC module on instance creation.
|
|
74
|
+ *
|
73
|
75
|
* @type {number}
|
74
|
76
|
*/
|
75
|
77
|
this.rtcId = rtcId;
|
|
@@ -176,6 +178,7 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
176
|
178
|
|
177
|
179
|
/**
|
178
|
180
|
* Returns if associated MediaStreamTrack is in the 'ended' state
|
|
181
|
+ *
|
179
|
182
|
* @returns {boolean}
|
180
|
183
|
*/
|
181
|
184
|
isEnded() {
|
|
@@ -253,8 +256,9 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
253
|
256
|
* Sets real device ID by comparing track information with device
|
254
|
257
|
* information. This is temporary solution until getConstraints() method
|
255
|
258
|
* will be implemented in browsers.
|
|
259
|
+ *
|
256
|
260
|
* @param {MediaDeviceInfo[]} devices - list of devices obtained from
|
257
|
|
- * enumerateDevices() call
|
|
261
|
+ * enumerateDevices() call
|
258
|
262
|
*/
|
259
|
263
|
_setRealDeviceIdFromDeviceList(devices) {
|
260
|
264
|
const track = this.getTrack();
|
|
@@ -392,7 +396,6 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
392
|
396
|
= RTCUtils.obtainAudioAndVideoPermissions(streamOptions);
|
393
|
397
|
}
|
394
|
398
|
|
395
|
|
-
|
396
|
399
|
promise.then(streamsInfo => {
|
397
|
400
|
const mediaType = this.getType();
|
398
|
401
|
const streamInfo
|
|
@@ -459,6 +462,7 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
459
|
462
|
|
460
|
463
|
/**
|
461
|
464
|
* Removes stream from conference and marks it as "mute" operation.
|
|
465
|
+ *
|
462
|
466
|
* @param {Function} successCallback will be called on success
|
463
|
467
|
* @param {Function} errorCallback will be called on error
|
464
|
468
|
* @private
|
|
@@ -527,10 +531,11 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
527
|
531
|
}
|
528
|
532
|
|
529
|
533
|
/**
|
530
|
|
- * Returns <tt>true</tt> - if the stream is muted
|
531
|
|
- * and <tt>false</tt> otherwise.
|
532
|
|
- * @returns {boolean} <tt>true</tt> - if the stream is muted
|
533
|
|
- * and <tt>false</tt> otherwise.
|
|
534
|
+ * Returns <tt>true</tt> - if the stream is muted and <tt>false</tt>
|
|
535
|
+ * otherwise.
|
|
536
|
+ *
|
|
537
|
+ * @returns {boolean} <tt>true</tt> - if the stream is muted and
|
|
538
|
+ * <tt>false</tt> otherwise.
|
534
|
539
|
*/
|
535
|
540
|
isMuted() {
|
536
|
541
|
// this.stream will be null when we mute local video on Chrome
|
|
@@ -542,12 +547,12 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
542
|
547
|
}
|
543
|
548
|
|
544
|
549
|
return !this.track || !this.track.enabled;
|
545
|
|
-
|
546
|
550
|
}
|
547
|
551
|
|
548
|
552
|
/**
|
549
|
553
|
* Sets the JitsiConference object associated with the track. This is temp
|
550
|
554
|
* solution.
|
|
555
|
+ *
|
551
|
556
|
* @param conference the JitsiConference object
|
552
|
557
|
*/
|
553
|
558
|
_setConference(conference) {
|
|
@@ -564,6 +569,7 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
564
|
569
|
|
565
|
570
|
/**
|
566
|
571
|
* Returns <tt>true</tt>.
|
|
572
|
+ *
|
567
|
573
|
* @returns {boolean} <tt>true</tt>
|
568
|
574
|
*/
|
569
|
575
|
isLocal() {
|
|
@@ -572,6 +578,7 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
572
|
578
|
|
573
|
579
|
/**
|
574
|
580
|
* Returns device id associated with track.
|
|
581
|
+ *
|
575
|
582
|
* @returns {string}
|
576
|
583
|
*/
|
577
|
584
|
getDeviceId() {
|
|
@@ -580,6 +587,7 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
580
|
587
|
|
581
|
588
|
/**
|
582
|
589
|
* Returns the participant id which owns the track.
|
|
590
|
+ *
|
583
|
591
|
* @returns {string} the id of the participants. It corresponds to the
|
584
|
592
|
* Colibri endpoint id/MUC nickname in case of Jitsi-meet.
|
585
|
593
|
*/
|
|
@@ -589,6 +597,7 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
589
|
597
|
|
590
|
598
|
/**
|
591
|
599
|
* Handles bytes sent statistics.
|
|
600
|
+ *
|
592
|
601
|
* @param {TraceablePeerConnection} tpc the source of the "bytes sent" stat
|
593
|
602
|
* @param {number} bytesSent the new value
|
594
|
603
|
* NOTE: used only for audio tracks to detect audio issues.
|
|
@@ -704,6 +713,7 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
704
|
713
|
|
705
|
714
|
/**
|
706
|
715
|
* Detects camera issues on ended and mute events from MediaStreamTrack.
|
|
716
|
+ *
|
707
|
717
|
* @returns {boolean} true if an issue is detected and false otherwise
|
708
|
718
|
*/
|
709
|
719
|
_checkForCameraIssues() {
|
|
@@ -723,6 +733,7 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
723
|
733
|
* NOTE: This method doesn't indicate problem with the streams directly.
|
724
|
734
|
* For example in case of video mute the method will return false or if the
|
725
|
735
|
* user has disposed the track.
|
|
736
|
+ *
|
726
|
737
|
* @returns {boolean} true if the stream is receiving data and false
|
727
|
738
|
* this otherwise.
|
728
|
739
|
*/
|
|
@@ -745,10 +756,10 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
745
|
756
|
|
746
|
757
|
/**
|
747
|
758
|
* Creates a text representation of this local track instance.
|
|
759
|
+ *
|
748
|
760
|
* @return {string}
|
749
|
761
|
*/
|
750
|
762
|
toString() {
|
751
|
763
|
return `LocalTrack[${this.rtcId},${this.getType()}]`;
|
752
|
764
|
}
|
753
|
|
-
|
754
|
765
|
}
|