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 42KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316
  1. /* global Strophe, $, Promise */
  2. /* jshint -W101 */
  3. var logger = require("jitsi-meet-logger").getLogger(__filename);
  4. var RTC = require("./modules/RTC/RTC");
  5. var XMPPEvents = require("./service/xmpp/XMPPEvents");
  6. var EventEmitter = require("events");
  7. var JitsiConferenceEvents = require("./JitsiConferenceEvents");
  8. var JitsiConferenceErrors = require("./JitsiConferenceErrors");
  9. var JitsiParticipant = require("./JitsiParticipant");
  10. var Statistics = require("./modules/statistics/statistics");
  11. var JitsiDTMFManager = require('./modules/DTMF/JitsiDTMFManager');
  12. var JitsiTrackEvents = require("./JitsiTrackEvents");
  13. var JitsiTrackErrors = require("./JitsiTrackErrors");
  14. var JitsiTrackError = require("./JitsiTrackError");
  15. var Settings = require("./modules/settings/Settings");
  16. var ComponentsVersions = require("./modules/version/ComponentsVersions");
  17. var GlobalOnErrorHandler = require("./modules/util/GlobalOnErrorHandler");
  18. var JitsiConferenceEventManager = require("./JitsiConferenceEventManager");
  19. var VideoType = require('./service/RTC/VideoType');
  20. var Transcriber = require("./modules/transcription/transcriber");
  21. /**
  22. * Creates a JitsiConference object with the given name and properties.
  23. * Note: this constructor is not a part of the public API (objects should be
  24. * created using JitsiConnection.createConference).
  25. * @param options.config properties / settings related to the conference that will be created.
  26. * @param options.name the name of the conference
  27. * @param options.connection the JitsiConnection object for this JitsiConference.
  28. * @constructor
  29. */
  30. function JitsiConference(options) {
  31. if(!options.name || options.name.toLowerCase() !== options.name) {
  32. var errmsg
  33. = "Invalid conference name (no conference name passed or it "
  34. + "contains invalid characters like capital letters)!";
  35. logger.error(errmsg);
  36. throw new Error(errmsg);
  37. }
  38. this.eventEmitter = new EventEmitter();
  39. this.settings = new Settings();
  40. this.options = options;
  41. this.eventManager = new JitsiConferenceEventManager(this);
  42. this._init(options);
  43. this.componentsVersions = new ComponentsVersions(this);
  44. this.participants = {};
  45. this.lastDominantSpeaker = null;
  46. this.dtmfManager = null;
  47. this.somebodySupportsDTMF = false;
  48. this.authEnabled = false;
  49. this.authIdentity;
  50. this.startAudioMuted = false;
  51. this.startVideoMuted = false;
  52. this.startMutedPolicy = {audio: false, video: false};
  53. this.availableDevices = {
  54. audio: undefined,
  55. video: undefined
  56. };
  57. this.isMutedByFocus = false;
  58. this.reportedAudioSSRCs = {};
  59. }
  60. /**
  61. * Initializes the conference object properties
  62. * @param options {object}
  63. * @param connection {JitsiConnection} overrides this.connection
  64. */
  65. JitsiConference.prototype._init = function (options) {
  66. if(!options)
  67. options = {};
  68. // Override connection and xmpp properties (Usefull if the connection
  69. // reloaded)
  70. if(options.connection) {
  71. this.connection = options.connection;
  72. this.xmpp = this.connection.xmpp;
  73. // Setup XMPP events only if we have new connection object.
  74. this.eventManager.setupXMPPListeners();
  75. }
  76. this.room = this.xmpp.createRoom(this.options.name, this.options.config,
  77. this.settings);
  78. this.room.updateDeviceAvailability(RTC.getDeviceAvailability());
  79. if(!this.rtc) {
  80. this.rtc = new RTC(this, options);
  81. this.eventManager.setupRTCListeners();
  82. }
  83. if(!this.statistics) {
  84. this.statistics = new Statistics(this.xmpp, {
  85. callStatsID: this.options.config.callStatsID,
  86. callStatsSecret: this.options.config.callStatsSecret,
  87. roomName: this.options.name
  88. });
  89. }
  90. this.eventManager.setupChatRoomListeners();
  91. // Always add listeners because on reload we are executing leave and the
  92. // listeners are removed from statistics module.
  93. this.eventManager.setupStatisticsListeners();
  94. }
  95. /**
  96. * Joins the conference.
  97. * @param password {string} the password
  98. */
  99. JitsiConference.prototype.join = function (password) {
  100. if(this.room)
  101. this.room.join(password);
  102. };
  103. /**
  104. * Check if joined to the conference.
  105. */
  106. JitsiConference.prototype.isJoined = function () {
  107. return this.room && this.room.joined;
  108. };
  109. /**
  110. * Leaves the conference and calls onMemberLeft for every participant.
  111. */
  112. JitsiConference.prototype._leaveRoomAndRemoveParticipants = function () {
  113. // remove all participants
  114. this.getParticipants().forEach(function (participant) {
  115. this.onMemberLeft(participant.getJid());
  116. }.bind(this));
  117. // leave the conference
  118. if (this.room) {
  119. this.room.leave();
  120. }
  121. this.room = null;
  122. this.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_LEFT);
  123. }
  124. /**
  125. * Leaves the conference.
  126. * @returns {Promise}
  127. */
  128. JitsiConference.prototype.leave = function () {
  129. var conference = this;
  130. this.statistics.stopCallStats();
  131. this.rtc.closeAllDataChannels();
  132. return Promise.all(
  133. conference.getLocalTracks().map(function (track) {
  134. return conference.removeTrack(track);
  135. })
  136. ).then(this._leaveRoomAndRemoveParticipants.bind(this))
  137. .catch(function (error) {
  138. logger.error(error);
  139. GlobalOnErrorHandler.callUnhandledRejectionHandler(
  140. {promise: this, reason: error});
  141. // We are proceeding with leaving the conference because room.leave may
  142. // succeed.
  143. this._leaveRoomAndRemoveParticipants();
  144. return Promise.resolve();
  145. }.bind(this));
  146. };
  147. /**
  148. * Returns name of this conference.
  149. */
  150. JitsiConference.prototype.getName = function () {
  151. return this.options.name;
  152. };
  153. /**
  154. * Check if authentication is enabled for this conference.
  155. */
  156. JitsiConference.prototype.isAuthEnabled = function () {
  157. return this.authEnabled;
  158. };
  159. /**
  160. * Check if user is logged in.
  161. */
  162. JitsiConference.prototype.isLoggedIn = function () {
  163. return !!this.authIdentity;
  164. };
  165. /**
  166. * Get authorized login.
  167. */
  168. JitsiConference.prototype.getAuthLogin = function () {
  169. return this.authIdentity;
  170. };
  171. /**
  172. * Check if external authentication is enabled for this conference.
  173. */
  174. JitsiConference.prototype.isExternalAuthEnabled = function () {
  175. return this.room && this.room.moderator.isExternalAuthEnabled();
  176. };
  177. /**
  178. * Get url for external authentication.
  179. * @param {boolean} [urlForPopup] if true then return url for login popup,
  180. * else url of login page.
  181. * @returns {Promise}
  182. */
  183. JitsiConference.prototype.getExternalAuthUrl = function (urlForPopup) {
  184. return new Promise(function (resolve, reject) {
  185. if (!this.isExternalAuthEnabled()) {
  186. reject();
  187. return;
  188. }
  189. if (urlForPopup) {
  190. this.room.moderator.getPopupLoginUrl(resolve, reject);
  191. } else {
  192. this.room.moderator.getLoginUrl(resolve, reject);
  193. }
  194. }.bind(this));
  195. };
  196. /**
  197. * Returns the local tracks.
  198. */
  199. JitsiConference.prototype.getLocalTracks = function () {
  200. if (this.rtc) {
  201. return this.rtc.localTracks.slice();
  202. } else {
  203. return [];
  204. }
  205. };
  206. /**
  207. * Attaches a handler for events(For example - "participant joined".) in the conference. All possible event are defined
  208. * in JitsiConferenceEvents.
  209. * @param eventId the event ID.
  210. * @param handler handler for the event.
  211. *
  212. * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
  213. */
  214. JitsiConference.prototype.on = function (eventId, handler) {
  215. if(this.eventEmitter)
  216. this.eventEmitter.on(eventId, handler);
  217. };
  218. /**
  219. * Removes event listener
  220. * @param eventId the event ID.
  221. * @param [handler] optional, the specific handler to unbind
  222. *
  223. * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
  224. */
  225. JitsiConference.prototype.off = function (eventId, handler) {
  226. if(this.eventEmitter)
  227. this.eventEmitter.removeListener(eventId, handler);
  228. };
  229. // Common aliases for event emitter
  230. JitsiConference.prototype.addEventListener = JitsiConference.prototype.on;
  231. JitsiConference.prototype.removeEventListener = JitsiConference.prototype.off;
  232. /**
  233. * Receives notifications from other participants about commands / custom events
  234. * (sent by sendCommand or sendCommandOnce methods).
  235. * @param command {String} the name of the command
  236. * @param handler {Function} handler for the command
  237. */
  238. JitsiConference.prototype.addCommandListener = function (command, handler) {
  239. if(this.room)
  240. this.room.addPresenceListener(command, handler);
  241. };
  242. /**
  243. * Removes command listener
  244. * @param command {String} the name of the command
  245. */
  246. JitsiConference.prototype.removeCommandListener = function (command) {
  247. if(this.room)
  248. this.room.removePresenceListener(command);
  249. };
  250. /**
  251. * Sends text message to the other participants in the conference
  252. * @param message the text message.
  253. */
  254. JitsiConference.prototype.sendTextMessage = function (message) {
  255. if(this.room)
  256. this.room.sendMessage(message);
  257. };
  258. /**
  259. * Send presence command.
  260. * @param name {String} the name of the command.
  261. * @param values {Object} with keys and values that will be sent.
  262. **/
  263. JitsiConference.prototype.sendCommand = function (name, values) {
  264. if(this.room) {
  265. this.room.addToPresence(name, values);
  266. this.room.sendPresence();
  267. }
  268. };
  269. /**
  270. * Send presence command one time.
  271. * @param name {String} the name of the command.
  272. * @param values {Object} with keys and values that will be sent.
  273. **/
  274. JitsiConference.prototype.sendCommandOnce = function (name, values) {
  275. this.sendCommand(name, values);
  276. this.removeCommand(name);
  277. };
  278. /**
  279. * Removes presence command.
  280. * @param name {String} the name of the command.
  281. **/
  282. JitsiConference.prototype.removeCommand = function (name) {
  283. if(this.room)
  284. this.room.removeFromPresence(name);
  285. };
  286. /**
  287. * Sets the display name for this conference.
  288. * @param name the display name to set
  289. */
  290. JitsiConference.prototype.setDisplayName = function(name) {
  291. if(this.room){
  292. // remove previously set nickname
  293. this.room.removeFromPresence("nick");
  294. this.room.addToPresence("nick", {attributes: {xmlns: 'http://jabber.org/protocol/nick'}, value: name});
  295. this.room.sendPresence();
  296. }
  297. };
  298. /**
  299. * Set new subject for this conference. (available only for moderator)
  300. * @param {string} subject new subject
  301. */
  302. JitsiConference.prototype.setSubject = function (subject) {
  303. if (this.room && this.isModerator()) {
  304. this.room.setSubject(subject);
  305. }
  306. };
  307. /**
  308. * Get a transcriber object for all current participants in this conference
  309. * @return {Transcriber} the transcriber object
  310. */
  311. JitsiConference.prototype.getTranscriber = function(){
  312. if(this.transcriber === undefined){
  313. this.transcriber = new Transcriber();
  314. //add all existing local audio tracks to the transcriber
  315. this.rtc.localTracks.forEach(function (localTrack) {
  316. if(localTrack.isAudioTrack()){
  317. this.transcriber.addTrack(localTrack);
  318. }
  319. }.bind(this));
  320. //and all remote audio tracks
  321. this.rtc.remoteTracks.forEach(function (remoteTrack){
  322. if(remoteTrack.isAudioTrack()){
  323. this.transcriber.addTrack(remoteTrack);
  324. }
  325. }.bind(this));
  326. }
  327. return this.transcriber;
  328. };
  329. /**
  330. * Adds JitsiLocalTrack object to the conference.
  331. * @param track the JitsiLocalTrack object.
  332. * @returns {Promise<JitsiLocalTrack>}
  333. * @throws {Error} if the specified track is a video track and there is already
  334. * another video track in the conference.
  335. */
  336. JitsiConference.prototype.addTrack = function (track) {
  337. if (track.disposed) {
  338. return Promise.reject(
  339. new JitsiTrackError(JitsiTrackErrors.TRACK_IS_DISPOSED));
  340. }
  341. if (track.isVideoTrack()) {
  342. // Ensure there's exactly 1 local video track in the conference.
  343. var localVideoTrack = this.rtc.getLocalVideoTrack();
  344. if (localVideoTrack) {
  345. // Don't be excessively harsh and severe if the API client happens
  346. // to attempt to add the same local video track twice.
  347. if (track === localVideoTrack) {
  348. return Promise.resolve(track);
  349. } else {
  350. return Promise.reject(new Error(
  351. "cannot add second video track to the conference"));
  352. }
  353. }
  354. }
  355. track.ssrcHandler = function (conference, ssrcMap) {
  356. if(ssrcMap[this.getMSID()]){
  357. this._setSSRC(ssrcMap[this.getMSID()]);
  358. conference.room.removeListener(XMPPEvents.SENDRECV_STREAMS_CHANGED,
  359. this.ssrcHandler);
  360. }
  361. }.bind(track, this);
  362. this.room.addListener(XMPPEvents.SENDRECV_STREAMS_CHANGED,
  363. track.ssrcHandler);
  364. if(track.isAudioTrack() || (track.isVideoTrack() &&
  365. track.videoType !== VideoType.DESKTOP)) {
  366. // Report active device to statistics
  367. var devices = RTC.getCurrentlyAvailableMediaDevices();
  368. device = devices.find(function (d) {
  369. return d.kind === track.getTrack().kind + 'input'
  370. && d.label === track.getTrack().label;
  371. });
  372. if(device)
  373. Statistics.sendActiveDeviceListEvent(
  374. RTC.getEventDataForActiveDevice(device));
  375. }
  376. return new Promise(function (resolve, reject) {
  377. this.room.addStream(track.getOriginalStream(), function () {
  378. if (track.isVideoTrack()) {
  379. this.removeCommand("videoType");
  380. this.sendCommand("videoType", {
  381. value: track.videoType,
  382. attributes: {
  383. xmlns: 'http://jitsi.org/jitmeet/video'
  384. }
  385. });
  386. }
  387. this.rtc.addLocalTrack(track);
  388. if (track.startMuted) {
  389. track.mute();
  390. }
  391. // ensure that we're sharing proper "is muted" state
  392. if (track.isAudioTrack()) {
  393. this.room.setAudioMute(track.isMuted());
  394. } else {
  395. this.room.setVideoMute(track.isMuted());
  396. }
  397. track.muteHandler = this._fireMuteChangeEvent.bind(this, track);
  398. track.audioLevelHandler = this._fireAudioLevelChangeEvent.bind(this);
  399. track.addEventListener(JitsiTrackEvents.TRACK_MUTE_CHANGED,
  400. track.muteHandler);
  401. track.addEventListener(JitsiTrackEvents.TRACK_AUDIO_LEVEL_CHANGED,
  402. track.audioLevelHandler);
  403. track._setConference(this);
  404. // send event for starting screen sharing
  405. // FIXME: we assume we have only one screen sharing track
  406. // if we change this we need to fix this check
  407. if (track.isVideoTrack() && track.videoType === VideoType.DESKTOP)
  408. this.statistics.sendScreenSharingEvent(true);
  409. this.eventEmitter.emit(JitsiConferenceEvents.TRACK_ADDED, track);
  410. resolve(track);
  411. }.bind(this), function (error) {
  412. reject(error);
  413. });
  414. }.bind(this));
  415. };
  416. /**
  417. * Fires TRACK_AUDIO_LEVEL_CHANGED change conference event.
  418. * @param audioLevel the audio level
  419. */
  420. JitsiConference.prototype._fireAudioLevelChangeEvent = function (audioLevel) {
  421. this.eventEmitter.emit(
  422. JitsiConferenceEvents.TRACK_AUDIO_LEVEL_CHANGED,
  423. this.myUserId(), audioLevel);
  424. };
  425. /**
  426. * Fires TRACK_MUTE_CHANGED change conference event.
  427. * @param track the JitsiTrack object related to the event.
  428. */
  429. JitsiConference.prototype._fireMuteChangeEvent = function (track) {
  430. // check if track was muted by focus and now is unmuted by user
  431. if (this.isMutedByFocus && track.isAudioTrack() && !track.isMuted()) {
  432. this.isMutedByFocus = false;
  433. // unmute local user on server
  434. this.room.muteParticipant(this.room.myroomjid, false);
  435. }
  436. this.eventEmitter.emit(JitsiConferenceEvents.TRACK_MUTE_CHANGED, track);
  437. };
  438. /**
  439. * Clear JitsiLocalTrack properties and listeners.
  440. * @param track the JitsiLocalTrack object.
  441. */
  442. JitsiConference.prototype.onTrackRemoved = function (track) {
  443. track._setSSRC(null);
  444. track._setConference(null);
  445. this.rtc.removeLocalTrack(track);
  446. track.removeEventListener(JitsiTrackEvents.TRACK_MUTE_CHANGED,
  447. track.muteHandler);
  448. track.removeEventListener(JitsiTrackEvents.TRACK_AUDIO_LEVEL_CHANGED,
  449. track.audioLevelHandler);
  450. this.room.removeListener(XMPPEvents.SENDRECV_STREAMS_CHANGED,
  451. track.ssrcHandler);
  452. // send event for stopping screen sharing
  453. // FIXME: we assume we have only one screen sharing track
  454. // if we change this we need to fix this check
  455. if (track.isVideoTrack() && track.videoType === VideoType.DESKTOP)
  456. this.statistics.sendScreenSharingEvent(false);
  457. this.eventEmitter.emit(JitsiConferenceEvents.TRACK_REMOVED, track);
  458. }
  459. /**
  460. * Removes JitsiLocalTrack object to the conference.
  461. * @param track the JitsiLocalTrack object.
  462. * @returns {Promise}
  463. */
  464. JitsiConference.prototype.removeTrack = function (track) {
  465. if (track.disposed) {
  466. return Promise.reject(
  467. new JitsiTrackError(JitsiTrackErrors.TRACK_IS_DISPOSED));
  468. }
  469. if(!this.room){
  470. if(this.rtc) {
  471. this.onTrackRemoved(track);
  472. }
  473. return Promise.resolve();
  474. }
  475. return new Promise(function (resolve, reject) {
  476. this.room.removeStream(track.getOriginalStream(), function(){
  477. this.onTrackRemoved(track);
  478. resolve();
  479. }.bind(this), function (error) {
  480. reject(error);
  481. }, {
  482. mtype: track.getType(),
  483. type: "remove",
  484. ssrc: track.ssrc});
  485. }.bind(this));
  486. };
  487. /**
  488. * Get role of the local user.
  489. * @returns {string} user role: 'moderator' or 'none'
  490. */
  491. JitsiConference.prototype.getRole = function () {
  492. return this.room.role;
  493. };
  494. /**
  495. * Check if local user is moderator.
  496. * @returns {boolean} true if local user is moderator, false otherwise.
  497. */
  498. JitsiConference.prototype.isModerator = function () {
  499. return this.room.isModerator();
  500. };
  501. /**
  502. * Set password for the room.
  503. * @param {string} password new password for the room.
  504. * @returns {Promise}
  505. */
  506. JitsiConference.prototype.lock = function (password) {
  507. if (!this.isModerator()) {
  508. return Promise.reject();
  509. }
  510. var conference = this;
  511. return new Promise(function (resolve, reject) {
  512. conference.room.lockRoom(password || "", function () {
  513. resolve();
  514. }, function (err) {
  515. reject(err);
  516. }, function () {
  517. reject(JitsiConferenceErrors.PASSWORD_NOT_SUPPORTED);
  518. });
  519. });
  520. };
  521. /**
  522. * Remove password from the room.
  523. * @returns {Promise}
  524. */
  525. JitsiConference.prototype.unlock = function () {
  526. return this.lock();
  527. };
  528. /**
  529. * Elects the participant with the given id to be the selected participant in
  530. * order to receive higher video quality (if simulcast is enabled).
  531. * @param participantId the identifier of the participant
  532. * @throws NetworkError or InvalidStateError or Error if the operation fails.
  533. */
  534. JitsiConference.prototype.selectParticipant = function(participantId) {
  535. this.rtc.selectEndpoint(participantId);
  536. };
  537. /**
  538. * Elects the participant with the given id to be the pinned participant in
  539. * order to always receive video for this participant (even when last n is
  540. * enabled).
  541. * @param participantId the identifier of the participant
  542. * @throws NetworkError or InvalidStateError or Error if the operation fails.
  543. */
  544. JitsiConference.prototype.pinParticipant = function(participantId) {
  545. this.rtc.pinEndpoint(participantId);
  546. };
  547. /**
  548. * Returns the list of participants for this conference.
  549. * @return Array<JitsiParticipant> a list of participant identifiers containing all conference participants.
  550. */
  551. JitsiConference.prototype.getParticipants = function() {
  552. return Object.keys(this.participants).map(function (key) {
  553. return this.participants[key];
  554. }, this);
  555. };
  556. /**
  557. * @returns {JitsiParticipant} the participant in this conference with the specified id (or
  558. * undefined if there isn't one).
  559. * @param id the id of the participant.
  560. */
  561. JitsiConference.prototype.getParticipantById = function(id) {
  562. return this.participants[id];
  563. };
  564. /**
  565. * Kick participant from this conference.
  566. * @param {string} id id of the participant to kick
  567. */
  568. JitsiConference.prototype.kickParticipant = function (id) {
  569. var participant = this.getParticipantById(id);
  570. if (!participant) {
  571. return;
  572. }
  573. this.room.kick(participant.getJid());
  574. };
  575. /**
  576. * Kick participant from this conference.
  577. * @param {string} id id of the participant to kick
  578. */
  579. JitsiConference.prototype.muteParticipant = function (id) {
  580. var participant = this.getParticipantById(id);
  581. if (!participant) {
  582. return;
  583. }
  584. this.room.muteParticipant(participant.getJid(), true);
  585. };
  586. /**
  587. * Indicates that a participant has joined the conference.
  588. *
  589. * @param jid the jid of the participant in the MUC
  590. * @param nick the display name of the participant
  591. * @param role the role of the participant in the MUC
  592. * @param isHidden indicates if this is a hidden participant (sysem participant,
  593. * for example a recorder).
  594. */
  595. JitsiConference.prototype.onMemberJoined
  596. = function (jid, nick, role, isHidden) {
  597. var id = Strophe.getResourceFromJid(jid);
  598. if (id === 'focus' || this.myUserId() === id) {
  599. return;
  600. }
  601. var participant = new JitsiParticipant(jid, this, nick, isHidden);
  602. participant._role = role;
  603. this.participants[id] = participant;
  604. this.eventEmitter.emit(JitsiConferenceEvents.USER_JOINED, id, participant);
  605. // XXX Since disco is checked in multiple places (e.g.
  606. // modules/xmpp/strophe.jingle.js, modules/xmpp/strophe.rayo.js), check it
  607. // here as well.
  608. var disco = this.xmpp.connection.disco;
  609. if (disco) {
  610. disco.info(
  611. jid, "node", function(iq) {
  612. participant._supportsDTMF = $(iq).find(
  613. '>query>feature[var="urn:xmpp:jingle:dtmf:0"]').length > 0;
  614. this.updateDTMFSupport();
  615. }.bind(this)
  616. );
  617. } else {
  618. // FIXME Should participant._supportsDTMF be assigned false here (and
  619. // this.updateDTMFSupport invoked)?
  620. }
  621. };
  622. JitsiConference.prototype.onMemberLeft = function (jid) {
  623. var id = Strophe.getResourceFromJid(jid);
  624. if (id === 'focus' || this.myUserId() === id) {
  625. return;
  626. }
  627. var participant = this.participants[id];
  628. delete this.participants[id];
  629. var removedTracks = this.rtc.removeRemoteTracks(id);
  630. removedTracks.forEach(function (track) {
  631. this.eventEmitter.emit(JitsiConferenceEvents.TRACK_REMOVED, track);
  632. }.bind(this));
  633. this.eventEmitter.emit(JitsiConferenceEvents.USER_LEFT, id, participant);
  634. };
  635. JitsiConference.prototype.onUserRoleChanged = function (jid, role) {
  636. var id = Strophe.getResourceFromJid(jid);
  637. var participant = this.getParticipantById(id);
  638. if (!participant) {
  639. return;
  640. }
  641. participant._role = role;
  642. this.eventEmitter.emit(JitsiConferenceEvents.USER_ROLE_CHANGED, id, role);
  643. };
  644. JitsiConference.prototype.onDisplayNameChanged = function (jid, displayName) {
  645. var id = Strophe.getResourceFromJid(jid);
  646. var participant = this.getParticipantById(id);
  647. if (!participant) {
  648. return;
  649. }
  650. if (participant._displayName === displayName)
  651. return;
  652. participant._displayName = displayName;
  653. this.eventEmitter.emit(JitsiConferenceEvents.DISPLAY_NAME_CHANGED, id, displayName);
  654. };
  655. /**
  656. * Notifies this JitsiConference that a JitsiRemoteTrack was added (into the
  657. * ChatRoom of this JitsiConference).
  658. *
  659. * @param {JitsiRemoteTrack} track the JitsiRemoteTrack which was added to this
  660. * JitsiConference
  661. */
  662. JitsiConference.prototype.onTrackAdded = function (track) {
  663. var id = track.getParticipantId();
  664. var participant = this.getParticipantById(id);
  665. if (!participant) {
  666. return;
  667. }
  668. // Add track to JitsiParticipant.
  669. participant._tracks.push(track);
  670. if(this.transcriber){
  671. this.transcriber.addTrack(track);
  672. }
  673. var emitter = this.eventEmitter;
  674. track.addEventListener(
  675. JitsiTrackEvents.TRACK_MUTE_CHANGED,
  676. function () {
  677. emitter.emit(JitsiConferenceEvents.TRACK_MUTE_CHANGED, track);
  678. }
  679. );
  680. track.addEventListener(
  681. JitsiTrackEvents.TRACK_AUDIO_LEVEL_CHANGED,
  682. function (audioLevel) {
  683. emitter.emit(
  684. JitsiConferenceEvents.TRACK_AUDIO_LEVEL_CHANGED,
  685. id,
  686. audioLevel);
  687. }
  688. );
  689. emitter.emit(JitsiConferenceEvents.TRACK_ADDED, track);
  690. };
  691. /**
  692. * Handles incoming call event.
  693. */
  694. JitsiConference.prototype.onIncomingCall =
  695. function (jingleSession, jingleOffer, now) {
  696. if (!this.room.isFocus(jingleSession.peerjid)) {
  697. // Error cause this should never happen unless something is wrong!
  698. var errmsg = "Rejecting session-initiate from non-focus user: "
  699. + jingleSession.peerjid;
  700. GlobalOnErrorHandler.callErrorHandler(new Error(errmsg));
  701. logger.error(errmsg);
  702. return;
  703. }
  704. // Accept incoming call
  705. this.room.setJingleSession(jingleSession);
  706. this.room.connectionTimes["session.initiate"] = now;
  707. // add info whether call is cross-region
  708. var crossRegion = null;
  709. if (window.jitsiRegionInfo)
  710. crossRegion = window.jitsiRegionInfo["CrossRegion"];
  711. Statistics.analytics.sendEvent("session.initiate",
  712. (now - this.room.connectionTimes["muc.joined"]),
  713. crossRegion);
  714. try{
  715. jingleSession.initialize(false /* initiator */,this.room);
  716. } catch (error) {
  717. GlobalOnErrorHandler.callErrorHandler(error);
  718. };
  719. this.rtc.onIncommingCall(jingleSession);
  720. // Add local Tracks to the ChatRoom
  721. this.rtc.localTracks.forEach(function(localTrack) {
  722. var ssrcInfo = null;
  723. if(localTrack.isVideoTrack() && localTrack.isMuted()) {
  724. /**
  725. * Handles issues when the stream is added before the peerconnection
  726. * is created. The peerconnection is created when second participant
  727. * enters the call. In that use case the track doesn't have
  728. * information about it's ssrcs and no jingle packets are sent. That
  729. * can cause inconsistent behavior later.
  730. *
  731. * For example:
  732. * If we mute the stream and than second participant enter it's
  733. * remote SDP won't include that track. On unmute we are not sending
  734. * any jingle packets which will brake the unmute.
  735. *
  736. * In order to solve issues like the above one here we have to
  737. * generate the ssrc information for the track .
  738. */
  739. localTrack._setSSRC(
  740. this.room.generateNewStreamSSRCInfo());
  741. ssrcInfo = {
  742. mtype: localTrack.getType(),
  743. type: "addMuted",
  744. ssrc: localTrack.ssrc,
  745. msid: localTrack.initialMSID
  746. };
  747. }
  748. try {
  749. this.room.addStream(
  750. localTrack.getOriginalStream(), function () {}, function () {},
  751. ssrcInfo, true);
  752. } catch(e) {
  753. GlobalOnErrorHandler.callErrorHandler(e);
  754. logger.error(e);
  755. }
  756. }.bind(this));
  757. jingleSession.acceptOffer(jingleOffer, null,
  758. function (error) {
  759. GlobalOnErrorHandler.callErrorHandler(error);
  760. logger.error(
  761. "Failed to accept incoming Jingle session", error);
  762. }
  763. );
  764. // Start callstats as soon as peerconnection is initialized,
  765. // do not wait for XMPPEvents.PEERCONNECTION_READY, as it may never
  766. // happen in case if user doesn't have or denied permission to
  767. // both camera and microphone.
  768. this.statistics.startCallStats(jingleSession, this.settings);
  769. this.statistics.startRemoteStats(jingleSession.peerconnection);
  770. };
  771. /**
  772. * Handles the call ended event.
  773. * @param {JingleSessionPC} JingleSession the jingle session which has been
  774. * terminated.
  775. * @param {String} reasonCondition the Jingle reason condition.
  776. * @param {String|null} reasonText human readable reason text which may provide
  777. * more details about why the call has been terminated.
  778. */
  779. JitsiConference.prototype.onCallEnded
  780. = function (JingleSession, reasonCondition, reasonText) {
  781. logger.info("Call ended: " + reasonCondition + " - " + reasonText);
  782. // Send analytics event
  783. Statistics.analytics.sendEvent(
  784. "session.terminate", window.performance.now());
  785. // Sends "session.terminate" through the stats as well
  786. this.sendApplicationLog(JSON.stringify({ "id" : "session_terminate" }));
  787. // Stop the stats
  788. if (this.statistics) {
  789. this.statistics.stopRemoteStats();
  790. this.statistics.stopCallStats();
  791. }
  792. // Current JingleSession is invalid so set it to null on the room
  793. this.room.setJingleSession(null);
  794. // Let the RTC service do any cleanups
  795. this.rtc.onCallEnded();
  796. // PeerConnection has been closed which means that SSRCs stored in
  797. // JitsiLocalTrack will not match those assigned by the old PeerConnection
  798. // and SSRC replacement logic will not work as expected.
  799. // We want to re-register 'ssrcHandler' of our local tracks, so that they
  800. // will learn what their SSRC from the new PeerConnection which will be
  801. // created on incoming call event.
  802. var self = this;
  803. this.rtc.localTracks.forEach(function(localTrack) {
  804. // Reset SSRC as it will no longer be valid
  805. localTrack._setSSRC(null);
  806. // Bind the handler to fetch new SSRC, it will un register itself once
  807. // it reads the values
  808. self.room.addListener(
  809. XMPPEvents.SENDRECV_STREAMS_CHANGED, localTrack.ssrcHandler);
  810. });
  811. };
  812. JitsiConference.prototype.updateDTMFSupport = function () {
  813. var somebodySupportsDTMF = false;
  814. var participants = this.getParticipants();
  815. // check if at least 1 participant supports DTMF
  816. for (var i = 0; i < participants.length; i += 1) {
  817. if (participants[i].supportsDTMF()) {
  818. somebodySupportsDTMF = true;
  819. break;
  820. }
  821. }
  822. if (somebodySupportsDTMF !== this.somebodySupportsDTMF) {
  823. this.somebodySupportsDTMF = somebodySupportsDTMF;
  824. this.eventEmitter.emit(JitsiConferenceEvents.DTMF_SUPPORT_CHANGED, somebodySupportsDTMF);
  825. }
  826. };
  827. /**
  828. * Allows to check if there is at least one user in the conference
  829. * that supports DTMF.
  830. * @returns {boolean} true if somebody supports DTMF, false otherwise
  831. */
  832. JitsiConference.prototype.isDTMFSupported = function () {
  833. return this.somebodySupportsDTMF;
  834. };
  835. /**
  836. * Returns the local user's ID
  837. * @return {string} local user's ID
  838. */
  839. JitsiConference.prototype.myUserId = function () {
  840. return (this.room && this.room.myroomjid)? Strophe.getResourceFromJid(this.room.myroomjid) : null;
  841. };
  842. JitsiConference.prototype.sendTones = function (tones, duration, pause) {
  843. if (!this.dtmfManager) {
  844. var connection = this.xmpp.connection.jingle.activecall.peerconnection;
  845. if (!connection) {
  846. logger.warn("cannot sendTones: no conneciton");
  847. return;
  848. }
  849. var tracks = this.getLocalTracks().filter(function (track) {
  850. return track.isAudioTrack();
  851. });
  852. if (!tracks.length) {
  853. logger.warn("cannot sendTones: no local audio stream");
  854. return;
  855. }
  856. this.dtmfManager = new JitsiDTMFManager(tracks[0], connection);
  857. }
  858. this.dtmfManager.sendTones(tones, duration, pause);
  859. };
  860. /**
  861. * Returns true if the recording is supproted and false if not.
  862. */
  863. JitsiConference.prototype.isRecordingSupported = function () {
  864. if(this.room)
  865. return this.room.isRecordingSupported();
  866. return false;
  867. };
  868. /**
  869. * Returns null if the recording is not supported, "on" if the recording started
  870. * and "off" if the recording is not started.
  871. */
  872. JitsiConference.prototype.getRecordingState = function () {
  873. return (this.room) ? this.room.getRecordingState() : undefined;
  874. }
  875. /**
  876. * Returns the url of the recorded video.
  877. */
  878. JitsiConference.prototype.getRecordingURL = function () {
  879. return (this.room) ? this.room.getRecordingURL() : null;
  880. }
  881. /**
  882. * Starts/stops the recording
  883. */
  884. JitsiConference.prototype.toggleRecording = function (options) {
  885. if(this.room)
  886. return this.room.toggleRecording(options, function (status, error) {
  887. this.eventEmitter.emit(
  888. JitsiConferenceEvents.RECORDER_STATE_CHANGED, status, error);
  889. }.bind(this));
  890. this.eventEmitter.emit(
  891. JitsiConferenceEvents.RECORDER_STATE_CHANGED, "error",
  892. new Error("The conference is not created yet!"));
  893. }
  894. /**
  895. * Returns true if the SIP calls are supported and false otherwise
  896. */
  897. JitsiConference.prototype.isSIPCallingSupported = function () {
  898. if(this.room)
  899. return this.room.isSIPCallingSupported();
  900. return false;
  901. }
  902. /**
  903. * Dials a number.
  904. * @param number the number
  905. */
  906. JitsiConference.prototype.dial = function (number) {
  907. if(this.room)
  908. return this.room.dial(number);
  909. return new Promise(function(resolve, reject){
  910. reject(new Error("The conference is not created yet!"))});
  911. }
  912. /**
  913. * Hangup an existing call
  914. */
  915. JitsiConference.prototype.hangup = function () {
  916. if(this.room)
  917. return this.room.hangup();
  918. return new Promise(function(resolve, reject){
  919. reject(new Error("The conference is not created yet!"))});
  920. }
  921. /**
  922. * Returns the phone number for joining the conference.
  923. */
  924. JitsiConference.prototype.getPhoneNumber = function () {
  925. if(this.room)
  926. return this.room.getPhoneNumber();
  927. return null;
  928. }
  929. /**
  930. * Returns the pin for joining the conference with phone.
  931. */
  932. JitsiConference.prototype.getPhonePin = function () {
  933. if(this.room)
  934. return this.room.getPhonePin();
  935. return null;
  936. }
  937. /**
  938. * Returns the connection state for the current room. Its ice connection state
  939. * for its session.
  940. */
  941. JitsiConference.prototype.getConnectionState = function () {
  942. if(this.room)
  943. return this.room.getConnectionState();
  944. return null;
  945. }
  946. /**
  947. * Make all new participants mute their audio/video on join.
  948. * @param policy {Object} object with 2 boolean properties for video and audio:
  949. * @param {boolean} audio if audio should be muted.
  950. * @param {boolean} video if video should be muted.
  951. */
  952. JitsiConference.prototype.setStartMutedPolicy = function (policy) {
  953. if (!this.isModerator()) {
  954. return;
  955. }
  956. this.startMutedPolicy = policy;
  957. this.room.removeFromPresence("startmuted");
  958. this.room.addToPresence("startmuted", {
  959. attributes: {
  960. audio: policy.audio,
  961. video: policy.video,
  962. xmlns: 'http://jitsi.org/jitmeet/start-muted'
  963. }
  964. });
  965. this.room.sendPresence();
  966. };
  967. /**
  968. * Returns current start muted policy
  969. * @returns {Object} with 2 proprties - audio and video.
  970. */
  971. JitsiConference.prototype.getStartMutedPolicy = function () {
  972. return this.startMutedPolicy;
  973. };
  974. /**
  975. * Check if audio is muted on join.
  976. */
  977. JitsiConference.prototype.isStartAudioMuted = function () {
  978. return this.startAudioMuted;
  979. };
  980. /**
  981. * Check if video is muted on join.
  982. */
  983. JitsiConference.prototype.isStartVideoMuted = function () {
  984. return this.startVideoMuted;
  985. };
  986. /**
  987. * Get object with internal logs.
  988. */
  989. JitsiConference.prototype.getLogs = function () {
  990. var data = this.xmpp.getJingleLog();
  991. var metadata = {};
  992. metadata.time = new Date();
  993. metadata.url = window.location.href;
  994. metadata.ua = navigator.userAgent;
  995. var log = this.xmpp.getXmppLog();
  996. if (log) {
  997. metadata.xmpp = log;
  998. }
  999. data.metadata = metadata;
  1000. return data;
  1001. };
  1002. /**
  1003. * Returns measured connectionTimes.
  1004. */
  1005. JitsiConference.prototype.getConnectionTimes = function () {
  1006. return this.room.connectionTimes;
  1007. };
  1008. /**
  1009. * Sets a property for the local participant.
  1010. */
  1011. JitsiConference.prototype.setLocalParticipantProperty = function(name, value) {
  1012. this.sendCommand("jitsi_participant_" + name, {value: value});
  1013. };
  1014. /**
  1015. * Sends the given feedback through CallStats if enabled.
  1016. *
  1017. * @param overallFeedback an integer between 1 and 5 indicating the
  1018. * user feedback
  1019. * @param detailedFeedback detailed feedback from the user. Not yet used
  1020. */
  1021. JitsiConference.prototype.sendFeedback =
  1022. function(overallFeedback, detailedFeedback){
  1023. this.statistics.sendFeedback(overallFeedback, detailedFeedback);
  1024. }
  1025. /**
  1026. * Returns true if the callstats integration is enabled, otherwise returns
  1027. * false.
  1028. *
  1029. * @returns true if the callstats integration is enabled, otherwise returns
  1030. * false.
  1031. */
  1032. JitsiConference.prototype.isCallstatsEnabled = function () {
  1033. return this.statistics.isCallstatsEnabled();
  1034. }
  1035. /**
  1036. * Handles track attached to container (Calls associateStreamWithVideoTag method
  1037. * from statistics module)
  1038. * @param track the track
  1039. * @param container the container
  1040. */
  1041. JitsiConference.prototype._onTrackAttach = function(track, container) {
  1042. var ssrc = track.getSSRC();
  1043. if (!container.id || !ssrc) {
  1044. return;
  1045. }
  1046. this.statistics.associateStreamWithVideoTag(
  1047. ssrc, track.isLocal(), track.getUsageLabel(), container.id);
  1048. }
  1049. /**
  1050. * Reports detected audio problem with the media stream related to the passed
  1051. * ssrc.
  1052. * @param ssrc {string} the ssrc
  1053. * NOTE: all logger.log calls are there only to be able to see the info in
  1054. * torture
  1055. */
  1056. JitsiConference.prototype._reportAudioProblem = function (ssrc) {
  1057. if(this.reportedAudioSSRCs[ssrc])
  1058. return;
  1059. var track = this.rtc.getRemoteTrackBySSRC(ssrc);
  1060. if(!track || !track.isAudioTrack())
  1061. return;
  1062. var id = track.getParticipantId();
  1063. var displayName = null;
  1064. if(id) {
  1065. var participant = this.getParticipantById(id);
  1066. if(participant) {
  1067. displayName = participant.getDisplayName();
  1068. }
  1069. }
  1070. this.reportedAudioSSRCs[ssrc] = true;
  1071. var errorContent = {
  1072. errMsg: "The audio is received but not played",
  1073. ssrc: ssrc,
  1074. jid: id,
  1075. displayName: displayName
  1076. };
  1077. logger.log("=================The audio is received but not played" +
  1078. "======================");
  1079. logger.log("ssrc: ", ssrc);
  1080. logger.log("jid: ", id);
  1081. logger.log("displayName: ", displayName);
  1082. var mstream = track.stream, mtrack = track.track;
  1083. if(mstream) {
  1084. logger.log("MediaStream:");
  1085. errorContent.MediaStream = {
  1086. active: mstream.active,
  1087. id: mstream.id
  1088. };
  1089. logger.log("active: ", mstream.active);
  1090. logger.log("id: ", mstream.id);
  1091. }
  1092. if(mtrack) {
  1093. logger.log("MediaStreamTrack:");
  1094. errorContent.MediaStreamTrack = {
  1095. enabled: mtrack.enabled,
  1096. id: mtrack.id,
  1097. label: mtrack.label,
  1098. muted: mtrack.muted
  1099. }
  1100. logger.log("enabled: ", mtrack.enabled);
  1101. logger.log("id: ", mtrack.id);
  1102. logger.log("label: ", mtrack.label);
  1103. logger.log("muted: ", mtrack.muted);
  1104. }
  1105. if(track.containers) {
  1106. errorContent.containers = [];
  1107. logger.log("Containers:");
  1108. track.containers.forEach(function (container) {
  1109. logger.log("Container:");
  1110. errorContent.containers.push({
  1111. autoplay: container.autoplay,
  1112. muted: container.muted,
  1113. src: container.src,
  1114. volume: container.volume,
  1115. id: container.id,
  1116. ended: container.ended,
  1117. paused: container.paused,
  1118. readyState: container.readyState
  1119. });
  1120. logger.log("autoplay: ", container.autoplay);
  1121. logger.log("muted: ", container.muted);
  1122. logger.log("src: ", container.src);
  1123. logger.log("volume: ", container.volume);
  1124. logger.log("id: ", container.id);
  1125. logger.log("ended: ", container.ended);
  1126. logger.log("paused: ", container.paused);
  1127. logger.log("readyState: ", container.readyState);
  1128. });
  1129. }
  1130. // Prints JSON.stringify(errorContent) to be able to see all properties of
  1131. // errorContent from torture
  1132. logger.error("Audio problem detected. The audio is received but not played",
  1133. errorContent);
  1134. delete errorContent.displayName;
  1135. this.statistics.sendDetectedAudioProblem(
  1136. new Error(JSON.stringify(errorContent)));
  1137. };
  1138. /**
  1139. * Logs an "application log" message.
  1140. * @param message {string} The message to log. Note that while this can be a
  1141. * generic string, the convention used by lib-jitsi-meet and jitsi-meet is to
  1142. * log valid JSON strings, with an "id" field used for distinguishing between
  1143. * message types. E.g.: {id: "recorder_status", status: "off"}
  1144. */
  1145. JitsiConference.prototype.sendApplicationLog = function(message) {
  1146. Statistics.sendLog(message);
  1147. };
  1148. /**
  1149. * Checks if the user identified by given <tt>mucJid</tt> is the conference
  1150. * focus.
  1151. * @param mucJid the full MUC address of the user to be checked.
  1152. * @returns {boolean} <tt>true</tt> if MUC user is the conference focus.
  1153. */
  1154. JitsiConference.prototype._isFocus = function (mucJid) {
  1155. return this.room.isFocus(mucJid);
  1156. };
  1157. /**
  1158. * Fires CONFERENCE_FAILED event with INCOMPATIBLE_SERVER_VERSIONS parameter
  1159. */
  1160. JitsiConference.prototype._fireIncompatibleVersionsEvent = function () {
  1161. this.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
  1162. JitsiConferenceErrors.INCOMPATIBLE_SERVER_VERSIONS);
  1163. };
  1164. /**
  1165. * Sends message via the datachannels.
  1166. * @param to {string} the id of the endpoint that should receive the message.
  1167. * If "" the message will be sent to all participants.
  1168. * @param payload {object} the payload of the message.
  1169. * @throws NetworkError or InvalidStateError or Error if the operation fails.
  1170. */
  1171. JitsiConference.prototype.sendEndpointMessage = function (to, payload) {
  1172. this.rtc.sendDataChannelMessage(to, payload);
  1173. }
  1174. /**
  1175. * Sends broadcast message via the datachannels.
  1176. * @param payload {object} the payload of the message.
  1177. * @throws NetworkError or InvalidStateError or Error if the operation fails.
  1178. */
  1179. JitsiConference.prototype.broadcastEndpointMessage = function (payload) {
  1180. this.sendEndpointMessage("", payload);
  1181. }
  1182. module.exports = JitsiConference;