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

functions.ts 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { IReduxState } from '../app/types';
  2. import { isWindows } from '../base/environment/environment';
  3. import { isMobileBrowser } from '../base/environment/utils';
  4. import { browser } from '../base/lib-jitsi-meet';
  5. import { getLocalDesktopTrack } from '../base/tracks/functions';
  6. /**
  7. * Is the current screen sharing session audio only.
  8. *
  9. * @param {IReduxState} state - The state of the application.
  10. * @returns {boolean}
  11. */
  12. export function isAudioOnlySharing(state: IReduxState) {
  13. return isScreenAudioShared(state) && !isScreenVideoShared(state);
  14. }
  15. /**
  16. * State of audio sharing.
  17. *
  18. * @param {IReduxState} state - The state of the application.
  19. * @returns {boolean}
  20. */
  21. export function isScreenAudioShared(state: IReduxState) {
  22. return state['features/screen-share'].isSharingAudio;
  23. }
  24. /**
  25. * Returns the visibility of the audio only screen share button. Currently only chrome browser and electron on
  26. * windows supports this functionality.
  27. *
  28. * @returns {boolean}
  29. */
  30. export function isScreenAudioSupported() {
  31. return (!isMobileBrowser() && browser.isChromiumBased()) || (browser.isElectron() && isWindows());
  32. }
  33. /**
  34. * Is any screen media currently being shared, audio or video.
  35. *
  36. * @param {IReduxState} state - The state of the application.
  37. * @returns {boolean}
  38. */
  39. export function isScreenMediaShared(state: IReduxState) {
  40. return isScreenAudioShared(state) || isScreenVideoShared(state);
  41. }
  42. /**
  43. * Is screen sharing currently active.
  44. *
  45. * @param {IReduxState} state - The state of the application.
  46. * @returns {boolean}
  47. */
  48. export function isScreenVideoShared(state: IReduxState) {
  49. const tracks = state['features/base/tracks'];
  50. const localScreenshare = getLocalDesktopTrack(tracks);
  51. return localScreenshare?.jitsiTrack && !localScreenshare.jitsiTrack.isMuted();
  52. }