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.

functions.web.js 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // @flow
  2. export * from './functions.any';
  3. /**
  4. * Returns the deviceId for the currently used camera.
  5. *
  6. * @param {Object} state - The state of the application.
  7. * @returns {void}
  8. */
  9. export function getCurrentCameraDeviceId(state: Object) {
  10. return getDeviceIdByType(state, 'isVideoTrack');
  11. }
  12. /**
  13. * Returns the deviceId for the currently used microphone.
  14. *
  15. * @param {Object} state - The state of the application.
  16. * @returns {void}
  17. */
  18. export function getCurrentMicDeviceId(state: Object) {
  19. return getDeviceIdByType(state, 'isAudioTrack');
  20. }
  21. /**
  22. * Returns the deviceId for the currently used speaker.
  23. *
  24. * @param {Object} state - The state of the application.
  25. * @returns {void}
  26. */
  27. export function getCurrentOutputDeviceId(state: Object) {
  28. return state['features/base/settings'].audioOutputDeviceId;
  29. }
  30. /**
  31. * Returns the deviceId for the corresponding local track type.
  32. *
  33. * @param {Object} state - The state of the application.
  34. * @param {string} isType - Can be 'isVideoTrack' | 'isAudioTrack'.
  35. * @returns {string}
  36. */
  37. function getDeviceIdByType(state: Object, isType: string) {
  38. const [ deviceId ] = state['features/base/tracks']
  39. .map(t => t.jitsiTrack)
  40. .filter(t => t && t.isLocal() && t[isType]())
  41. .map(t => t.getDeviceId());
  42. return deviceId || '';
  43. }
  44. /**
  45. * Returns the saved display name.
  46. *
  47. * @param {Object} state - The state of the application.
  48. * @returns {string}
  49. */
  50. export function getDisplayName(state: Object): string {
  51. return state['features/base/settings'].displayName || '';
  52. }
  53. /**
  54. * Handles changes to the `disableCallIntegration` setting.
  55. * Noop on web.
  56. *
  57. * @param {boolean} disabled - Whether call integration is disabled or not.
  58. * @returns {void}
  59. */
  60. export function handleCallIntegrationChange(disabled: boolean) { // eslint-disable-line no-unused-vars
  61. }
  62. /**
  63. * Handles changes to the `disableCrashReporting` setting.
  64. * Noop on web.
  65. *
  66. * @param {boolean} disabled - Whether crash reporting is disabled or not.
  67. * @returns {void}
  68. */
  69. export function handleCrashReportingChange(disabled: boolean) { // eslint-disable-line no-unused-vars
  70. }