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.ts 1.1KB

1234567891011121314151617181920212223242526272829303132333435
  1. /* eslint-disable max-params, max-len */
  2. import { MIN_SUBTITLES_FONT_SIZE } from './constants';
  3. /**
  4. * Logs when about the received transcription chunk.
  5. *
  6. * @param {string} transcriptMessageID - Transcription message id.
  7. * @param {string} language - The language of the transcribed message.
  8. * @param {Object} participant - The participant who send the message.
  9. * @param {any} text - The message text.
  10. * @param {any} _store - The store.
  11. * @returns {Event}
  12. */
  13. export const notifyTranscriptionChunkReceived = (transcriptMessageID: string, language: string, participant: Object, text: any, _store?: any) =>
  14. APP.API.notifyTranscriptionChunkReceived({
  15. messageID: transcriptMessageID,
  16. language,
  17. participant,
  18. ...text
  19. });
  20. /**
  21. * Calculates the font size for the subtitles.
  22. *
  23. * @param {number} clientHeight - The height of the visible area of the window.
  24. * @returns {number}
  25. */
  26. export function calculateSubtitlesFontSize(clientHeight?: number) {
  27. if (typeof clientHeight === 'undefined') {
  28. return MIN_SUBTITLES_FONT_SIZE;
  29. }
  30. return Math.max(Math.floor(clientHeight * 0.04), MIN_SUBTITLES_FONT_SIZE);
  31. }