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.

VideoSettingsPopup.js 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // @flow
  2. import InlineDialog from '@atlaskit/inline-dialog';
  3. import React from 'react';
  4. import {
  5. getVideoDeviceIds,
  6. setVideoInputDeviceAndUpdateSettings
  7. } from '../../../../base/devices';
  8. import { connect } from '../../../../base/redux';
  9. import { getCurrentCameraDeviceId } from '../../../../base/settings';
  10. import { toggleVideoSettings } from '../../../actions';
  11. import { getVideoSettingsVisibility } from '../../../functions';
  12. import VideoSettingsContent, { type Props as VideoSettingsProps } from './VideoSettingsContent';
  13. type Props = VideoSettingsProps & {
  14. /**
  15. * Component children (the Video button).
  16. */
  17. children: React$Node,
  18. /**
  19. * Flag controlling the visibility of the popup.
  20. */
  21. isOpen: boolean,
  22. /**
  23. * Callback executed when the popup closes.
  24. */
  25. onClose: Function,
  26. }
  27. /**
  28. * Popup with a preview of all the video devices.
  29. *
  30. * @returns {ReactElement}
  31. */
  32. function VideoSettingsPopup({
  33. currentCameraDeviceId,
  34. children,
  35. isOpen,
  36. onClose,
  37. setVideoInputDevice,
  38. videoDeviceIds
  39. }: Props) {
  40. return (
  41. <div className = 'video-preview'>
  42. <InlineDialog
  43. content = { <VideoSettingsContent
  44. currentCameraDeviceId = { currentCameraDeviceId }
  45. setVideoInputDevice = { setVideoInputDevice }
  46. toggleVideoSettings = { onClose }
  47. videoDeviceIds = { videoDeviceIds } /> }
  48. isOpen = { isOpen }
  49. onClose = { onClose }
  50. placement = 'top-end'>
  51. { children }
  52. </InlineDialog>
  53. </div>
  54. );
  55. }
  56. /**
  57. * Maps (parts of) the redux state to the associated {@code VideoSettingsPopup}'s
  58. * props.
  59. *
  60. * @param {Object} state - Redux state.
  61. * @returns {Object}
  62. */
  63. function mapStateToProps(state) {
  64. return {
  65. currentCameraDeviceId: getCurrentCameraDeviceId(state),
  66. isOpen: getVideoSettingsVisibility(state),
  67. videoDeviceIds: getVideoDeviceIds(state)
  68. };
  69. }
  70. const mapDispatchToProps = {
  71. onClose: toggleVideoSettings,
  72. setVideoInputDevice: setVideoInputDeviceAndUpdateSettings
  73. };
  74. export default connect(mapStateToProps, mapDispatchToProps)(VideoSettingsPopup);