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

MeetingParticipantItem.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // @flow
  2. import React, { useCallback } from 'react';
  3. import { useSelector, useDispatch } from 'react-redux';
  4. import {
  5. getIsParticipantAudioMuted,
  6. getIsParticipantVideoMuted
  7. } from '../../../base/tracks';
  8. import { showContextMenuDetails } from '../../actions.native';
  9. import { MEDIA_STATE } from '../../constants';
  10. import { getParticipantAudioMediaState } from '../../functions';
  11. import ParticipantItem from './ParticipantItem';
  12. type Props = {
  13. /**
  14. * Participant reference
  15. */
  16. participant: Object
  17. };
  18. export const MeetingParticipantItem = ({ participant: p }: Props) => {
  19. const dispatch = useDispatch();
  20. const isAudioMuted = useSelector(getIsParticipantAudioMuted(p));
  21. const isVideoMuted = useSelector(getIsParticipantVideoMuted(p));
  22. const audioMediaState = useSelector(getParticipantAudioMediaState(p, isAudioMuted));
  23. const openContextMenuDetails = useCallback(() => !p.local && dispatch(showContextMenuDetails(p), [ dispatch ]));
  24. return (
  25. <ParticipantItem
  26. audioMediaState = { audioMediaState }
  27. isKnockingParticipant = { false }
  28. name = { p.name }
  29. onPress = { openContextMenuDetails }
  30. participant = { p }
  31. videoMediaState = { isVideoMuted ? MEDIA_STATE.MUTED : MEDIA_STATE.UNMUTED } />
  32. );
  33. };