選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

functions.web.ts 2.3KB

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