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.

JitsiMeetJS.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. var JitsiConnection = require("./JitsiConnection");
  2. var JitsiConferenceEvents = require("./JitsiConferenceEvents");
  3. var JitsiConnectionEvents = require("./JitsiConnectionEvents");
  4. var JitsiConnectionErrors = require("./JitsiConnectionErrors");
  5. var JitsiConferenceErrors = require("./JitsiConferenceErrors");
  6. var Logger = require("jitsi-meet-logger");
  7. var RTC = require("./modules/RTC/RTC");
  8. /**
  9. * Namespace for the interface of Jitsi Meet Library.
  10. */
  11. var LibJitsiMeet = {
  12. JitsiConnection: JitsiConnection,
  13. events: {
  14. conference: JitsiConferenceEvents,
  15. connection: JitsiConnectionEvents
  16. },
  17. errors: {
  18. conference: JitsiConferenceErrors,
  19. connection: JitsiConnectionErrors
  20. },
  21. logLevels: Logger.levels,
  22. init: function (options) {
  23. RTC.init(options || {});
  24. },
  25. setLogLevel: function (level) {
  26. Logger.setLogLevel(level);
  27. },
  28. /**
  29. * Creates the media tracks and returns them trough the callback.
  30. * @param options Object with properties / settings specifying the tracks which should be created.
  31. * should be created or some additional configurations about resolution for example.
  32. * @param {Array} options.devices the devices that will be requested
  33. * @param {string} options.resolution resolution constraints
  34. * @param {bool} options.dontCreateJitsiTrack if <tt>true</tt> objects with the following structure {stream: the Media Stream,
  35. * type: "audio" or "video", videoType: "camera" or "desktop"}
  36. * will be returned trough the Promise, otherwise JitsiTrack objects will be returned.
  37. * @param {string} options.cameraDeviceId
  38. * @param {string} options.micDeviceId
  39. * @returns {Promise.<{Array.<JitsiTrack>}, JitsiConferenceError>} A promise that returns an array of created JitsiTracks if resolved,
  40. * or a JitsiConferenceError if rejected.
  41. */
  42. createLocalTracks: function (options) {
  43. return RTC.obtainAudioAndVideoPermissions(options || {});
  44. },
  45. isDeviceListAvailable: function () {
  46. return RTC.isDeviceListAvailable();
  47. },
  48. enumerateDevices: function (callback) {
  49. RTC.enumerateDevices(callback);
  50. }
  51. };
  52. require("es6-promise").polyfill()
  53. //Setups the promise object.
  54. window.Promise = window.Promise || require("es6-promise").Promise;
  55. module.exports = LibJitsiMeet;