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.3KB

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