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.

FeatureFlags.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import browser from '../browser';
  2. /**
  3. * A global module for accessing information about different feature flags state.
  4. */
  5. class FeatureFlags {
  6. /**
  7. * Configures the module.
  8. *
  9. * @param {object} flags - The feature flags.
  10. * @param {boolean=} flags.runInLiteMode - Enables lite mode for testing to disable media decoding.
  11. * @param {boolean=} flags.ssrcRewritingEnabled - Use SSRC rewriting. Requires sourceNameSignaling to be enabled.
  12. * @param {boolean=} flags.enableJoinAsVisitor - Enable joining as a visitor.
  13. */
  14. init(flags) {
  15. this._runInLiteMode = Boolean(flags.runInLiteMode);
  16. this._ssrcRewriting = Boolean(flags.ssrcRewritingEnabled);
  17. this._joinAsVisitor = Boolean(flags.enableJoinAsVisitor ?? true);
  18. }
  19. /**
  20. * Checks if multiple local video streams support is enabled.
  21. *
  22. * @returns {boolean}
  23. */
  24. isMultiStreamSendSupportEnabled() {
  25. return browser.supportsUnifiedPlan();
  26. }
  27. /**
  28. * Checks if the run in lite mode is enabled.
  29. * This will cause any media to be received and not decoded. (Insertable streams are used to discard
  30. * all media before it is decoded). This can be used for various test scenarios.
  31. *
  32. * @returns {boolean}
  33. */
  34. isRunInLiteModeEnabled() {
  35. return this._runInLiteMode && browser.supportsInsertableStreams();
  36. }
  37. /**
  38. * Checks if the clients supports re-writing of the SSRCs on the media streams by the bridge.
  39. * @returns {boolean}
  40. */
  41. isSsrcRewritingSupported() {
  42. return this._ssrcRewriting;
  43. }
  44. /**
  45. * Checks if the clients supports joining as a visitor.
  46. * @returns {boolean}
  47. */
  48. isJoinAsVisitorSupported() {
  49. return this._joinAsVisitor;
  50. }
  51. }
  52. export default new FeatureFlags();