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.

actions.native.ts 935B

1234567891011121314151617181920212223242526272829
  1. import { IStore } from '../../app/types';
  2. import { setAudioMuted, setVideoMuted } from '../media/actions';
  3. import { MEDIA_TYPE, MediaType, VIDEO_MUTISM_AUTHORITY } from '../media/constants';
  4. export * from './actions.any';
  5. /**
  6. * Starts audio and/or video for the visitor.
  7. *
  8. * @param {Array<MediaType>} mediaTypes - The media types that need to be started.
  9. * @returns {Function}
  10. */
  11. export function setupVisitorStartupMedia(mediaTypes: Array<MediaType>) {
  12. return (dispatch: IStore['dispatch']) => {
  13. if (!mediaTypes || !Array.isArray(mediaTypes)) {
  14. return;
  15. }
  16. mediaTypes.forEach(mediaType => {
  17. switch (mediaType) {
  18. case MEDIA_TYPE.AUDIO:
  19. dispatch(setAudioMuted(false, true));
  20. break;
  21. case MEDIA_TYPE.VIDEO:
  22. dispatch(setVideoMuted(false, VIDEO_MUTISM_AUTHORITY.USER, true));
  23. }
  24. });
  25. };
  26. }