You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

JitsiParticipant.js 3.5KB

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