Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

JitsiLocalTrack.js 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. /* global __filename, Promise */
  2. var CameraFacingMode = require('../../service/RTC/CameraFacingMode');
  3. var JitsiTrack = require("./JitsiTrack");
  4. import JitsiTrackError from "../../JitsiTrackError";
  5. import * as JitsiTrackErrors from "../../JitsiTrackErrors";
  6. import * as JitsiTrackEvents from "../../JitsiTrackEvents";
  7. var logger = require("jitsi-meet-logger").getLogger(__filename);
  8. var MediaType = require('../../service/RTC/MediaType');
  9. var RTCBrowserType = require("./RTCBrowserType");
  10. var RTCEvents = require("../../service/RTC/RTCEvents");
  11. var RTCUtils = require("./RTCUtils");
  12. var Statistics = require("../statistics/statistics");
  13. var VideoType = require('../../service/RTC/VideoType');
  14. /**
  15. * Represents a single media track(either audio or video).
  16. * One <tt>JitsiLocalTrack</tt> corresponds to one WebRTC MediaStreamTrack.
  17. * @param stream WebRTC MediaStream, parent of the track
  18. * @param track underlying WebRTC MediaStreamTrack for new JitsiRemoteTrack
  19. * @param mediaType the MediaType of the JitsiRemoteTrack
  20. * @param videoType the VideoType of the JitsiRemoteTrack
  21. * @param resolution the video resoultion if it's a video track
  22. * @param deviceId the ID of the local device for this track
  23. * @param facingMode the camera facing mode used in getUserMedia call
  24. * @constructor
  25. */
  26. function JitsiLocalTrack(stream, track, mediaType, videoType, resolution,
  27. deviceId, facingMode) {
  28. var self = this;
  29. JitsiTrack.call(this,
  30. null /* RTC */, stream, track,
  31. function () {
  32. if(!this.dontFireRemoveEvent)
  33. this.eventEmitter.emit(
  34. JitsiTrackEvents.LOCAL_TRACK_STOPPED);
  35. this.dontFireRemoveEvent = false;
  36. }.bind(this) /* inactiveHandler */,
  37. mediaType, videoType, null /* ssrc */);
  38. this.dontFireRemoveEvent = false;
  39. this.resolution = resolution;
  40. // FIXME: currently firefox is ignoring our constraints about resolutions
  41. // so we do not store it, to avoid wrong reporting of local track resolution
  42. if (RTCBrowserType.isFirefox())
  43. this.resolution = null;
  44. this.deviceId = deviceId;
  45. this.startMuted = false;
  46. this.initialMSID = this.getMSID();
  47. this.inMuteOrUnmuteProgress = false;
  48. /**
  49. * The facing mode of the camera from which this JitsiLocalTrack instance
  50. * was obtained.
  51. */
  52. this._facingMode = facingMode;
  53. // Currently there is no way to know the MediaStreamTrack ended due to to
  54. // device disconnect in Firefox through e.g. "readyState" property. Instead
  55. // we will compare current track's label with device labels from
  56. // enumerateDevices() list.
  57. this._trackEnded = false;
  58. /**
  59. * The value of bytes sent received from the statistics module.
  60. */
  61. this._bytesSent = null;
  62. /**
  63. * Used only for detection of audio problems. We want to check only once
  64. * whether the track is sending bytes ot not. This flag is set to false
  65. * after the check.
  66. */
  67. this._testByteSent = true;
  68. // Currently there is no way to determine with what device track was
  69. // created (until getConstraints() support), however we can associate tracks
  70. // with real devices obtained from enumerateDevices() call as soon as it's
  71. // called.
  72. this._realDeviceId = this.deviceId === '' ? undefined : this.deviceId;
  73. /**
  74. * Indicates that we have called RTCUtils.stopMediaStream for the
  75. * MediaStream related to this JitsiTrack object.
  76. */
  77. this.stopStreamInProgress = false;
  78. /**
  79. * On mute event we are waiting for 3s to check if the stream is going to
  80. * be still muted before firing the event for camera issue detected
  81. * (NO_DATA_FROM_SOURCE).
  82. */
  83. this._noDataFromSourceTimeout = null;
  84. this._onDeviceListChanged = function (devices) {
  85. self._setRealDeviceIdFromDeviceList(devices);
  86. // Mark track as ended for those browsers that do not support
  87. // "readyState" property. We do not touch tracks created with default
  88. // device ID "".
  89. if (typeof self.getTrack().readyState === 'undefined'
  90. && typeof self._realDeviceId !== 'undefined'
  91. && !devices.find(function (d) {
  92. return d.deviceId === self._realDeviceId;
  93. })) {
  94. self._trackEnded = true;
  95. }
  96. };
  97. // Subscribe each created local audio track to
  98. // RTCEvents.AUDIO_OUTPUT_DEVICE_CHANGED event. This is different from
  99. // handling this event for remote tracks (which are handled in RTC.js),
  100. // because there might be local tracks not attached to a conference.
  101. if (this.isAudioTrack() && RTCUtils.isDeviceChangeAvailable('output')) {
  102. this._onAudioOutputDeviceChanged = this.setAudioOutput.bind(this);
  103. RTCUtils.addListener(RTCEvents.AUDIO_OUTPUT_DEVICE_CHANGED,
  104. this._onAudioOutputDeviceChanged);
  105. }
  106. RTCUtils.addListener(RTCEvents.DEVICE_LIST_CHANGED,
  107. this._onDeviceListChanged);
  108. this._initNoDataFromSourceHandlers();
  109. }
  110. JitsiLocalTrack.prototype = Object.create(JitsiTrack.prototype);
  111. JitsiLocalTrack.prototype.constructor = JitsiLocalTrack;
  112. /**
  113. * Returns if associated MediaStreamTrack is in the 'ended' state
  114. * @returns {boolean}
  115. */
  116. JitsiLocalTrack.prototype.isEnded = function () {
  117. return this.getTrack().readyState === 'ended' || this._trackEnded;
  118. };
  119. /**
  120. * Sets handlers to the MediaStreamTrack object that will detect camera issues.
  121. */
  122. JitsiLocalTrack.prototype._initNoDataFromSourceHandlers = function () {
  123. if(this.isVideoTrack() && this.videoType === VideoType.CAMERA) {
  124. let _onNoDataFromSourceError
  125. = this._onNoDataFromSourceError.bind(this);
  126. this._setHandler("track_mute", () => {
  127. if(this._checkForCameraIssues()) {
  128. let now = window.performance.now();
  129. this._noDataFromSourceTimeout
  130. = setTimeout(_onNoDataFromSourceError, 3000);
  131. this._setHandler("track_unmute", () => {
  132. this._clearNoDataFromSourceMuteResources();
  133. Statistics.sendEventToAll(
  134. this.getType() + ".track_unmute",
  135. {value: window.performance.now() - now});
  136. });
  137. }
  138. });
  139. this._setHandler("track_ended", _onNoDataFromSourceError);
  140. }
  141. };
  142. /**
  143. * Clears all timeouts and handlers set on MediaStreamTrack mute event.
  144. * FIXME: Change the name of the method with better one.
  145. */
  146. JitsiLocalTrack.prototype._clearNoDataFromSourceMuteResources = function () {
  147. if(this._noDataFromSourceTimeout) {
  148. clearTimeout(this._noDataFromSourceTimeout);
  149. this._noDataFromSourceTimeout = null;
  150. }
  151. this._setHandler("track_unmute", undefined);
  152. };
  153. /**
  154. * Called when potential camera issue is detected. Clears the handlers and
  155. * timeouts set on MediaStreamTrack muted event. Verifies that the camera
  156. * issue persists and fires NO_DATA_FROM_SOURCE event.
  157. */
  158. JitsiLocalTrack.prototype._onNoDataFromSourceError = function () {
  159. this._clearNoDataFromSourceMuteResources();
  160. if(this._checkForCameraIssues())
  161. this._fireNoDataFromSourceEvent();
  162. };
  163. /**
  164. * Fires JitsiTrackEvents.NO_DATA_FROM_SOURCE and logs it to analytics and
  165. * callstats.
  166. */
  167. JitsiLocalTrack.prototype._fireNoDataFromSourceEvent = function () {
  168. this.eventEmitter.emit(JitsiTrackEvents.NO_DATA_FROM_SOURCE);
  169. Statistics.sendEventToAll(this.getType() + ".no_data_from_source");
  170. };
  171. /**
  172. * Sets real device ID by comparing track information with device information.
  173. * This is temporary solution until getConstraints() method will be implemented
  174. * in browsers.
  175. * @param {MediaDeviceInfo[]} devices - list of devices obtained from
  176. * enumerateDevices() call
  177. */
  178. JitsiLocalTrack.prototype._setRealDeviceIdFromDeviceList = function (devices) {
  179. var track = this.getTrack(),
  180. device = devices.find(function (d) {
  181. return d.kind === track.kind + 'input' && d.label === track.label;
  182. });
  183. if (device) {
  184. this._realDeviceId = device.deviceId;
  185. }
  186. };
  187. /**
  188. * Mutes the track. Will reject the Promise if there is mute/unmute operation
  189. * in progress.
  190. * @returns {Promise}
  191. */
  192. JitsiLocalTrack.prototype.mute = function () {
  193. return createMuteUnmutePromise(this, true);
  194. };
  195. /**
  196. * Unmutes the track. Will reject the Promise if there is mute/unmute operation
  197. * in progress.
  198. * @returns {Promise}
  199. */
  200. JitsiLocalTrack.prototype.unmute = function () {
  201. return createMuteUnmutePromise(this, false);
  202. };
  203. /**
  204. * Creates Promise for mute/unmute operation.
  205. *
  206. * @param {JitsiLocalTrack} track - The track that will be muted/unmuted.
  207. * @param {boolean} mute - Whether to mute or unmute the track.
  208. * @returns {Promise}
  209. */
  210. function createMuteUnmutePromise(track, mute) {
  211. if (track.inMuteOrUnmuteProgress) {
  212. return Promise.reject(
  213. new JitsiTrackError(JitsiTrackErrors.TRACK_MUTE_UNMUTE_IN_PROGRESS)
  214. );
  215. }
  216. track.inMuteOrUnmuteProgress = true;
  217. return track._setMute(mute)
  218. .then(function() {
  219. track.inMuteOrUnmuteProgress = false;
  220. })
  221. .catch(function(status) {
  222. track.inMuteOrUnmuteProgress = false;
  223. throw status;
  224. });
  225. }
  226. /**
  227. * Mutes / unmutes the track.
  228. *
  229. * @param {boolean} mute - If true the track will be muted. Otherwise the track
  230. * will be unmuted.
  231. * @private
  232. * @returns {Promise}
  233. */
  234. JitsiLocalTrack.prototype._setMute = function (mute) {
  235. if (this.isMuted() === mute) {
  236. return Promise.resolve();
  237. }
  238. var promise = Promise.resolve();
  239. var self = this;
  240. // Local track can be used out of conference, so we need to handle that
  241. // case and mark that track should start muted or not when added to
  242. // conference.
  243. if(!this.conference || !this.conference.room) {
  244. this.startMuted = mute;
  245. }
  246. this.dontFireRemoveEvent = false;
  247. // FIXME FF does not support 'removeStream' method used to mute
  248. if (window.location.protocol !== "https:" ||
  249. this.isAudioTrack() ||
  250. this.videoType === VideoType.DESKTOP ||
  251. RTCBrowserType.isFirefox()) {
  252. if(this.track)
  253. this.track.enabled = !mute;
  254. } else {
  255. if(mute) {
  256. this.dontFireRemoveEvent = true;
  257. promise = new Promise( (resolve, reject) => {
  258. this._removeStreamFromConferenceAsMute(() => {
  259. //FIXME: Maybe here we should set the SRC for the containers
  260. // to something
  261. this._stopMediaStream();
  262. this._setStream(null);
  263. resolve();
  264. }, (err) => {
  265. reject(err);
  266. });
  267. });
  268. } else {
  269. // This path is only for camera.
  270. var streamOptions = {
  271. cameraDeviceId: this.getDeviceId(),
  272. devices: [ MediaType.VIDEO ],
  273. facingMode: this.getCameraFacingMode()
  274. };
  275. if (this.resolution)
  276. streamOptions.resolution = this.resolution;
  277. promise = RTCUtils.obtainAudioAndVideoPermissions(streamOptions)
  278. .then(function (streamsInfo) {
  279. var mediaType = self.getType();
  280. var streamInfo = streamsInfo.find(function(info) {
  281. return info.mediaType === mediaType;
  282. });
  283. if(!streamInfo) {
  284. throw new JitsiTrackError(
  285. JitsiTrackErrors.TRACK_NO_STREAM_FOUND);
  286. }else {
  287. self._setStream(streamInfo.stream);
  288. self.track = streamInfo.track;
  289. // This is not good when video type changes after
  290. // unmute, but let's not crash here
  291. if (self.videoType !== streamInfo.videoType) {
  292. logger.warn(
  293. "Video type has changed after unmute!",
  294. self.videoType, streamInfo.videoType);
  295. self.videoType = streamInfo.videoType;
  296. }
  297. }
  298. self.containers = self.containers.map(function(cont) {
  299. return RTCUtils.attachMediaStream(cont, self.stream);
  300. });
  301. return self._addStreamToConferenceAsUnmute();
  302. });
  303. }
  304. }
  305. return promise
  306. .then(function() {
  307. return self._sendMuteStatus(mute);
  308. })
  309. .then(function() {
  310. self.eventEmitter.emit(JitsiTrackEvents.TRACK_MUTE_CHANGED, this);
  311. });
  312. };
  313. /**
  314. * Adds stream to conference and marks it as "unmute" operation.
  315. *
  316. * @private
  317. * @returns {Promise}
  318. */
  319. JitsiLocalTrack.prototype._addStreamToConferenceAsUnmute = function () {
  320. if (!this.conference || !this.conference.room) {
  321. return Promise.resolve();
  322. }
  323. var self = this;
  324. return new Promise(function(resolve, reject) {
  325. self.conference.room.addStream(
  326. self.stream,
  327. resolve,
  328. reject,
  329. {
  330. mtype: self.type,
  331. type: "unmute",
  332. ssrc: self.ssrc,
  333. msid: self.getMSID()
  334. });
  335. });
  336. };
  337. /**
  338. * Removes stream from conference and marks it as "mute" operation.
  339. * @param {Function} successCallback will be called on success
  340. * @param {Function} errorCallback will be called on error
  341. * @private
  342. */
  343. JitsiLocalTrack.prototype._removeStreamFromConferenceAsMute =
  344. function (successCallback, errorCallback) {
  345. if (!this.conference || !this.conference.room) {
  346. successCallback();
  347. return;
  348. }
  349. this.conference.room.removeStream(
  350. this.stream,
  351. successCallback,
  352. errorCallback,
  353. {
  354. mtype: this.type,
  355. type: "mute",
  356. ssrc: this.ssrc
  357. });
  358. };
  359. /**
  360. * Sends mute status for a track to conference if any.
  361. *
  362. * @param {boolean} mute - If track is muted.
  363. * @private
  364. * @returns {Promise}
  365. */
  366. JitsiLocalTrack.prototype._sendMuteStatus = function(mute) {
  367. if (!this.conference || !this.conference.room) {
  368. return Promise.resolve();
  369. }
  370. var self = this;
  371. return new Promise(function(resolve) {
  372. self.conference.room[
  373. self.isAudioTrack()
  374. ? 'setAudioMute'
  375. : 'setVideoMute'](mute, resolve);
  376. });
  377. };
  378. /**
  379. * @inheritdoc
  380. *
  381. * Stops sending the media track. And removes it from the HTML.
  382. * NOTE: Works for local tracks only.
  383. *
  384. * @extends JitsiTrack#dispose
  385. * @returns {Promise}
  386. */
  387. JitsiLocalTrack.prototype.dispose = function () {
  388. var self = this;
  389. var promise = Promise.resolve();
  390. if (this.conference){
  391. promise = this.conference.removeTrack(this);
  392. }
  393. if (this.stream) {
  394. this._stopMediaStream();
  395. this.detach();
  396. }
  397. RTCUtils.removeListener(RTCEvents.DEVICE_LIST_CHANGED,
  398. this._onDeviceListChanged);
  399. if (this._onAudioOutputDeviceChanged) {
  400. RTCUtils.removeListener(RTCEvents.AUDIO_OUTPUT_DEVICE_CHANGED,
  401. this._onAudioOutputDeviceChanged);
  402. }
  403. return promise
  404. .then(function() {
  405. return JitsiTrack.prototype.dispose.call(self); // super.dispose();
  406. });
  407. };
  408. /**
  409. * Returns <tt>true</tt> - if the stream is muted
  410. * and <tt>false</tt> otherwise.
  411. * @returns {boolean} <tt>true</tt> - if the stream is muted
  412. * and <tt>false</tt> otherwise.
  413. */
  414. JitsiLocalTrack.prototype.isMuted = function () {
  415. // this.stream will be null when we mute local video on Chrome
  416. if (!this.stream)
  417. return true;
  418. if (this.isVideoTrack() && !this.isActive()) {
  419. return true;
  420. } else {
  421. return !this.track || !this.track.enabled;
  422. }
  423. };
  424. /**
  425. * Updates the SSRC associated with the MediaStream in JitsiLocalTrack object.
  426. * @ssrc the new ssrc
  427. */
  428. JitsiLocalTrack.prototype._setSSRC = function (ssrc) {
  429. this.ssrc = ssrc;
  430. };
  431. /**
  432. * Sets the JitsiConference object associated with the track. This is temp
  433. * solution.
  434. * @param conference the JitsiConference object
  435. */
  436. JitsiLocalTrack.prototype._setConference = function(conference) {
  437. this.conference = conference;
  438. // We want to keep up with postponed events which should have been fired
  439. // on "attach" call, but for local track we not always have the conference
  440. // before attaching. However this may result in duplicated events if they
  441. // have been triggered on "attach" already.
  442. for(var i = 0; i < this.containers.length; i++)
  443. {
  444. this._maybeFireTrackAttached(this.containers[i]);
  445. }
  446. };
  447. /**
  448. * Gets the SSRC of this local track if it's available already or <tt>null</tt>
  449. * otherwise. That's because we don't know the SSRC until local description is
  450. * created.
  451. * In case of video and simulcast returns the the primarySSRC.
  452. * @returns {string} or {null}
  453. */
  454. JitsiLocalTrack.prototype.getSSRC = function () {
  455. if(this.ssrc && this.ssrc.groups && this.ssrc.groups.length)
  456. return this.ssrc.groups[0].primarySSRC;
  457. else if(this.ssrc && this.ssrc.ssrcs && this.ssrc.ssrcs.length)
  458. return this.ssrc.ssrcs[0];
  459. else
  460. return null;
  461. };
  462. /**
  463. * Returns <tt>true</tt>.
  464. * @returns {boolean} <tt>true</tt>
  465. */
  466. JitsiLocalTrack.prototype.isLocal = function () {
  467. return true;
  468. };
  469. /**
  470. * Returns device id associated with track.
  471. * @returns {string}
  472. */
  473. JitsiLocalTrack.prototype.getDeviceId = function () {
  474. return this._realDeviceId || this.deviceId;
  475. };
  476. /**
  477. * Sets the value of bytes sent statistic.
  478. * @param bytesSent {intiger} the new value
  479. * NOTE: used only for audio tracks to detect audio issues.
  480. */
  481. JitsiLocalTrack.prototype._setByteSent = function (bytesSent) {
  482. this._bytesSent = bytesSent;
  483. // FIXME it's a shame that PeerConnection and ICE status does not belong
  484. // to the RTC module and it has to be accessed through
  485. // the conference(and through the XMPP chat room ???) instead
  486. let iceConnectionState
  487. = this.conference ? this.conference.getConnectionState() : null;
  488. if(this._testByteSent && "connected" === iceConnectionState) {
  489. setTimeout(function () {
  490. if(this._bytesSent <= 0){
  491. //we are not receiving anything from the microphone
  492. this._fireNoDataFromSourceEvent();
  493. }
  494. }.bind(this), 3000);
  495. this._testByteSent = false;
  496. }
  497. };
  498. /**
  499. * Returns facing mode for video track from camera. For other cases (e.g. audio
  500. * track or 'desktop' video track) returns undefined.
  501. *
  502. * @returns {CameraFacingMode|undefined}
  503. */
  504. JitsiLocalTrack.prototype.getCameraFacingMode = function () {
  505. if (this.isVideoTrack() && this.videoType === VideoType.CAMERA) {
  506. // MediaStreamTrack#getSettings() is not implemented in many browsers,
  507. // so we need feature checking here. Progress on the respective
  508. // browser's implementation can be tracked at
  509. // https://bugs.chromium.org/p/webrtc/issues/detail?id=2481 for Chromium
  510. // and https://bugzilla.mozilla.org/show_bug.cgi?id=1213517 for Firefox.
  511. // Even if a browser implements getSettings() already, it might still
  512. // not return anything for 'facingMode'.
  513. var trackSettings;
  514. try {
  515. trackSettings = this.track.getSettings();
  516. } catch (e) {
  517. // XXX React-native-webrtc, for example, defines
  518. // MediaStreamTrack#getSettings() but the implementation throws a
  519. // "Not implemented" Error.
  520. }
  521. if (trackSettings && 'facingMode' in trackSettings) {
  522. return trackSettings.facingMode;
  523. }
  524. if (typeof this._facingMode !== 'undefined') {
  525. return this._facingMode;
  526. }
  527. // In most cases we are showing a webcam. So if we've gotten here, it
  528. // should be relatively safe to assume that we are probably showing
  529. // the user-facing camera.
  530. return CameraFacingMode.USER;
  531. }
  532. return undefined;
  533. };
  534. /**
  535. * Stops the associated MediaStream.
  536. */
  537. JitsiLocalTrack.prototype._stopMediaStream = function () {
  538. this.stopStreamInProgress = true;
  539. RTCUtils.stopMediaStream(this.stream);
  540. this.stopStreamInProgress = false;
  541. };
  542. /**
  543. * Detects camera issues on ended and mute events from MediaStreamTrack.
  544. * @returns {boolean} true if an issue is detected and false otherwise
  545. */
  546. JitsiLocalTrack.prototype._checkForCameraIssues = function () {
  547. if(!this.isVideoTrack() || this.stopStreamInProgress ||
  548. this.videoType === VideoType.DESKTOP)
  549. return false;
  550. return !this._isReceivingData();
  551. };
  552. /**
  553. * Checks whether the attached MediaStream is reveiving data from source or
  554. * not. If the stream property is null(because of mute or another reason) this
  555. * method will return false.
  556. * NOTE: This method doesn't indicate problem with the streams directly.
  557. * For example in case of video mute the method will return false or if the
  558. * user has disposed the track.
  559. * @returns {boolean} true if the stream is receiving data and false otherwise.
  560. */
  561. JitsiLocalTrack.prototype._isReceivingData = function () {
  562. if(!this.stream)
  563. return false;
  564. // In older version of the spec there is no muted property and
  565. // readyState can have value muted. In the latest versions
  566. // readyState can have values "live" and "ended" and there is
  567. // muted boolean property. If the stream is muted that means that
  568. // we aren't receiving any data from the source. We want to notify
  569. // the users for error if the stream is muted or ended on it's
  570. // creation.
  571. return this.stream.getTracks().some(track =>
  572. ((!("readyState" in track) || track.readyState === "live")
  573. && (!("muted" in track) || track.muted === false)));
  574. };
  575. module.exports = JitsiLocalTrack;