您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

FeatureFlags.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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.
  12. */
  13. init(flags) {
  14. this._runInLiteMode = Boolean(flags.runInLiteMode);
  15. this._ssrcRewriting = Boolean(flags.ssrcRewritingEnabled);
  16. }
  17. /**
  18. * Checks if the run in lite mode is enabled.
  19. * This will cause any media to be received and not decoded. (Insertable streams are used to discard
  20. * all media before it is decoded). This can be used for various test scenarios.
  21. *
  22. * @returns {boolean}
  23. */
  24. isRunInLiteModeEnabled() {
  25. return this._runInLiteMode && browser.supportsInsertableStreams();
  26. }
  27. /**
  28. * Checks if the clients supports re-writing of the SSRCs on the media streams by the bridge.
  29. * @returns {boolean}
  30. */
  31. isSsrcRewritingSupported() {
  32. return this._ssrcRewriting;
  33. }
  34. }
  35. export default new FeatureFlags();