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.

JitsiConference.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. var room = null;
  2. /**
  3. * Creates a JitsiConference object with the given name and properties.
  4. * Note: this constructor is not a part of the public API (objects should be
  5. * created using JitsiConnection.createConference).
  6. * @param options.config properties / settings related to the conference that will be created.
  7. * @param options.name the name of the conference
  8. * @param options.connection the JitsiConnection object for this JitsiConference.
  9. * @constructor
  10. */
  11. function JitsiConference(options) {
  12. this.options = options;
  13. this.connection = this.options.connection;
  14. this.xmpp = this.connection.xmpp;
  15. }
  16. /**
  17. * Joins the conference.
  18. */
  19. JitsiConference.prototype.join = function () {
  20. room = this.xmpp.joinRoom(this.options.name, null, null);
  21. }
  22. /**
  23. * Leaves the conference.
  24. */
  25. JitsiConference.prototype.leave = function () {
  26. this.xmpp.leaveRoom(room.roomjid);
  27. room = null;
  28. }
  29. /**
  30. * Creates the media tracks and returns them via the callback.
  31. * @param options Object with properties / settings specifying the tracks which should be created.
  32. * should be created or some additional configurations about resolution for example.
  33. * @returns {Promise.<{Array.<JitsiTrack>}, JitsiConferenceError>} A promise that returns an array of created JitsiTracks if resolved,
  34. * or a JitsiConferenceError if rejected.
  35. */
  36. JitsiConference.prototype.createLocalTracks = function (options) {
  37. }
  38. /**
  39. * Returns the local tracks.
  40. */
  41. JitsiConference.prototype.getLocalTracks = function () {
  42. };
  43. /**
  44. * Attaches a handler for events(For example - "participant joined".) in the conference. All possible event are defined
  45. * in JitsiConferenceEvents.
  46. * @param eventId the event ID.
  47. * @param handler handler for the event.
  48. *
  49. * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
  50. */
  51. JitsiConference.prototype.on = function (eventId, handler) {
  52. this.xmpp.addListener(eventId, handler);
  53. }
  54. /**
  55. * Removes event listener
  56. * @param eventId the event ID.
  57. * @param [handler] optional, the specific handler to unbind
  58. *
  59. * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
  60. */
  61. JitsiConference.prototype.off = function (eventId, handler) {
  62. this.xmpp.removeListener(event, listener);
  63. }
  64. // Common aliases for event emitter
  65. JitsiConference.prototype.addEventListener = JitsiConference.prototype.on
  66. JitsiConference.prototype.removeEventListener = JitsiConference.prototype.off
  67. /**
  68. * Receives notifications from another participants for commands / custom events(send by sendPresenceCommand method).
  69. * @param command {String} the name of the command
  70. * @param handler {Function} handler for the command
  71. */
  72. JitsiConference.prototype.addCommandListener = function (command, handler) {
  73. }
  74. /**
  75. * Removes command listener
  76. * @param command {String} the name of the command
  77. */
  78. JitsiConference.prototype.removeCommandListener = function (command) {
  79. }
  80. /**
  81. * Sends text message to the other participants in the conference
  82. * @param message the text message.
  83. */
  84. JitsiConference.prototype.sendTextMessage = function (message) {
  85. room.send
  86. }
  87. /**
  88. * Send presence command.
  89. * @param name the name of the command.
  90. * @param values Object with keys and values that will be send.
  91. * @param persistent if false the command will be sent only one time
  92. * @param successCallback will be called when the command is successfully send.
  93. * @param errorCallback will be called when the command is not sent successfully.
  94. * @returns {Promise.<{void}, JitsiConferenceError>} A promise that returns an array of created streams if resolved,
  95. * or an JitsiConferenceError if rejected.
  96. */
  97. JitsiConference.prototype.sendCommand = function (name, values, persistent) {
  98. }
  99. /**
  100. * Sets the display name for this conference.
  101. * @param name the display name to set
  102. */
  103. JitsiConference.prototype.setDisplayName = function(name) {
  104. room.addToPresence("nick", {attributes: {xmlns: 'http://jabber.org/protocol/nick'}, value: name});
  105. }
  106. /**
  107. * Elects the participant with the given id to be the selected participant or the speaker.
  108. * @param id the identifier of the participant
  109. */
  110. JitsiConference.prototype.selectParticipant = function(participantId) {
  111. }
  112. /**
  113. * Returns the list of participants for this conference.
  114. * @return Object a list of participant identifiers containing all conference participants.
  115. */
  116. JitsiConference.prototype.getParticipants = function() {
  117. }
  118. module.exports = JitsiConference;