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

actions.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import { openDialog } from '../base/dialog';
  2. import {
  3. RESET_DESKTOP_SOURCES,
  4. UPDATE_DESKTOP_SOURCES
  5. } from './actionTypes';
  6. import { DesktopPicker } from './components';
  7. const logger = require('jitsi-meet-logger').getLogger(__filename);
  8. /**
  9. * Begins a request to get available DesktopCapturerSources.
  10. *
  11. * @param {Array} types - An array with DesktopCapturerSource type strings.
  12. * @param {Object} options - Additional configuration for getting a list of
  13. * sources.
  14. * @param {Object} options.thumbnailSize - The desired height and width of the
  15. * return native image object used for the preview image of the source.
  16. * @returns {Function}
  17. */
  18. export function obtainDesktopSources(types, options = {}) {
  19. const capturerOptions = {
  20. types
  21. };
  22. if (options.thumbnailSize) {
  23. capturerOptions.thumbnailSize = options.thumbnailSize;
  24. }
  25. return dispatch => {
  26. const { JitsiMeetElectron } = window;
  27. if (JitsiMeetElectron && JitsiMeetElectron.obtainDesktopStreams) {
  28. JitsiMeetElectron.obtainDesktopStreams(
  29. sources => dispatch(updateDesktopSources(sources)),
  30. error =>
  31. logger.error(
  32. `Error while obtaining desktop sources: ${error}`),
  33. capturerOptions
  34. );
  35. } else {
  36. logger.error(
  37. 'Called JitsiMeetElectron.obtainDesktopStreams'
  38. + ' but it is not defined');
  39. }
  40. };
  41. }
  42. /**
  43. * Signals to remove all stored DesktopCapturerSources.
  44. *
  45. * @returns {{
  46. * type: RESET_DESKTOP_SOURCES
  47. * }}
  48. */
  49. export function resetDesktopSources() {
  50. return {
  51. type: RESET_DESKTOP_SOURCES
  52. };
  53. }
  54. /**
  55. * Signals to open a dialog with the DesktopPicker component.
  56. *
  57. * @param {Function} onSourceChoose - The callback to invoke when
  58. * a DesktopCapturerSource has been chosen.
  59. * @returns {Object}
  60. */
  61. export function showDesktopPicker(onSourceChoose) {
  62. return openDialog(DesktopPicker, {
  63. onSourceChoose
  64. });
  65. }
  66. /**
  67. * Signals new DesktopCapturerSources have been received.
  68. *
  69. * @param {Object} sources - Arrays with DesktopCapturerSources.
  70. * @returns {{
  71. * type: UPDATE_DESKTOP_SOURCES,
  72. * sources: Array
  73. * }}
  74. */
  75. export function updateDesktopSources(sources) {
  76. return {
  77. type: UPDATE_DESKTOP_SOURCES,
  78. sources
  79. };
  80. }