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

middleware.web.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // @flow
  2. import { getCurrentConference } from '../base/conference';
  3. import { getLocalParticipant } from '../base/participants';
  4. import { StateListenerRegistry } from '../base/redux';
  5. import { setDisableButton } from './actions.web';
  6. import { SHARED_VIDEO } from './constants';
  7. import './middleware.any';
  8. /**
  9. * Set up state change listener to disable or enable the share video button in
  10. * the toolbar menu.
  11. */
  12. StateListenerRegistry.register(
  13. state => getCurrentConference(state),
  14. (conference, store, previousConference) => {
  15. if (conference && conference !== previousConference) {
  16. conference.addCommandListener(SHARED_VIDEO,
  17. ({ attributes }) => {
  18. const { dispatch, getState } = store;
  19. const { from } = attributes;
  20. const localParticipantId = getLocalParticipant(getState()).id;
  21. const status = attributes.state;
  22. if (status === 'playing') {
  23. if (localParticipantId !== from) {
  24. dispatch(setDisableButton(true));
  25. }
  26. } else if (status === 'stop') {
  27. dispatch(setDisableButton(false));
  28. }
  29. }
  30. );
  31. }
  32. }
  33. );