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.

functions.js 1022B

123456789101112131415161718192021222324252627282930
  1. import { VIDEO_MUTISM_AUTHORITY } from './constants';
  2. /**
  3. * Determines whether a specific videoTrack should be rendered.
  4. *
  5. * @param {Track} videoTrack - The video track which is to be rendered.
  6. * @param {boolean} waitForVideoStarted - True if the specified videoTrack
  7. * should be rendered only after its associated video has started;
  8. * otherwise, false.
  9. * @returns {boolean} True if the specified videoTrack should be renderd;
  10. * otherwise, false.
  11. */
  12. export function shouldRenderVideoTrack(videoTrack, waitForVideoStarted) {
  13. return (
  14. videoTrack
  15. && !videoTrack.muted
  16. && (!waitForVideoStarted || videoTrack.videoStarted));
  17. }
  18. /**
  19. * Checks if video is currently muted by the user authority.
  20. *
  21. * @param {Object} store - The redux store instance.
  22. * @returns {boolean}
  23. */
  24. export function isVideoMutedByUser({ getState }) {
  25. return Boolean(
  26. getState()['features/base/media'] // eslint-disable-line no-bitwise
  27. .video.muted & VIDEO_MUTISM_AUTHORITY.USER);
  28. }