Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

JitsiParticipant.js 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /* global Strophe */
  2. /**
  3. * Represents a participant in (a member of) a conference.
  4. * @param jid the conference XMPP jid
  5. * @param conference
  6. * @param displayName
  7. * @param isHidden indicates if this participant is a hidden participant
  8. */
  9. function JitsiParticipant(jid, conference, displayName, isHidden){
  10. this._jid = jid;
  11. this._id = Strophe.getResourceFromJid(jid);
  12. this._conference = conference;
  13. this._displayName = displayName;
  14. this._supportsDTMF = false;
  15. this._tracks = [];
  16. this._role = 'none';
  17. this._status = null;
  18. this._availableDevices = {
  19. audio: undefined,
  20. video: undefined
  21. };
  22. this._isHidden = isHidden;
  23. }
  24. /**
  25. * @returns {JitsiConference} The conference that this participant belongs to.
  26. */
  27. JitsiParticipant.prototype.getConference = function() {
  28. return this._conference;
  29. };
  30. /**
  31. * @returns {Array.<JitsiTrack>} The list of media tracks for this participant.
  32. */
  33. JitsiParticipant.prototype.getTracks = function() {
  34. return this._tracks.slice();
  35. };
  36. /**
  37. * @returns {String} The ID of this participant.
  38. */
  39. JitsiParticipant.prototype.getId = function() {
  40. return this._id;
  41. };
  42. /**
  43. * @returns {String} The JID of this participant.
  44. */
  45. JitsiParticipant.prototype.getJid = function() {
  46. return this._jid;
  47. };
  48. /**
  49. * @returns {String} The human-readable display name of this participant.
  50. */
  51. JitsiParticipant.prototype.getDisplayName = function() {
  52. return this._displayName;
  53. };
  54. /**
  55. * @returns {String} The status of the participant.
  56. */
  57. JitsiParticipant.prototype.getStatus = function () {
  58. return this._status;
  59. };
  60. /**
  61. * @returns {Boolean} Whether this participant is a moderator or not.
  62. */
  63. JitsiParticipant.prototype.isModerator = function() {
  64. return this._role === 'moderator';
  65. };
  66. /**
  67. * @returns {Boolean} Whether this participant is a hidden participant. Some
  68. * special system participants may want to join hidden (like for example the
  69. * recorder).
  70. */
  71. JitsiParticipant.prototype.isHidden = function() {
  72. return this._isHidden;
  73. };
  74. // Gets a link to an etherpad instance advertised by the participant?
  75. //JitsiParticipant.prototype.getEtherpad = function() {
  76. //
  77. //}
  78. /*
  79. * @returns {Boolean} Whether this participant has muted their audio.
  80. */
  81. JitsiParticipant.prototype.isAudioMuted = function() {
  82. return this.getTracks().reduce(function (track, isAudioMuted) {
  83. return isAudioMuted && (track.isVideoTrack() || track.isMuted());
  84. }, true);
  85. };
  86. /*
  87. * @returns {Boolean} Whether this participant has muted their video.
  88. */
  89. JitsiParticipant.prototype.isVideoMuted = function() {
  90. return this.getTracks().reduce(function (track, isVideoMuted) {
  91. return isVideoMuted && (track.isAudioTrack() || track.isMuted());
  92. }, true);
  93. };
  94. /*
  95. * @returns {???} The latest statistics reported by this participant
  96. * (i.e. info used to populate the GSM bars)
  97. * TODO: do we expose this or handle it internally?
  98. */
  99. JitsiParticipant.prototype.getLatestStats = function() {
  100. };
  101. /**
  102. * @returns {String} The role of this participant.
  103. */
  104. JitsiParticipant.prototype.getRole = function() {
  105. return this._role;
  106. };
  107. /*
  108. * @returns {Boolean} Whether this participant is
  109. * the conference focus (i.e. jicofo).
  110. */
  111. JitsiParticipant.prototype.isFocus = function() {
  112. };
  113. /*
  114. * @returns {Boolean} Whether this participant is
  115. * a conference recorder (i.e. jirecon).
  116. */
  117. JitsiParticipant.prototype.isRecorder = function() {
  118. };
  119. /*
  120. * @returns {Boolean} Whether this participant is a SIP gateway (i.e. jigasi).
  121. */
  122. JitsiParticipant.prototype.isSipGateway = function() {
  123. };
  124. /**
  125. * @returns {Boolean} Whether this participant
  126. * is currently sharing their screen.
  127. */
  128. JitsiParticipant.prototype.isScreenSharing = function() {
  129. };
  130. /**
  131. * @returns {String} The user agent of this participant
  132. * (i.e. browser userAgent string).
  133. */
  134. JitsiParticipant.prototype.getUserAgent = function() {
  135. };
  136. /**
  137. * Kicks the participant from the conference (requires certain privileges).
  138. */
  139. JitsiParticipant.prototype.kick = function() {
  140. };
  141. /**
  142. * Asks this participant to mute themselves.
  143. */
  144. JitsiParticipant.prototype.askToMute = function() {
  145. };
  146. JitsiParticipant.prototype.supportsDTMF = function () {
  147. return this._supportsDTMF;
  148. };
  149. module.exports = JitsiParticipant;