Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

functions.native.ts 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { IStore } from '../../app/types';
  2. import JitsiMeetJS from '../lib-jitsi-meet';
  3. import { getCameraFacingMode } from './functions.any';
  4. import { ITrackOptions } from './types';
  5. export * from './functions.any';
  6. /**
  7. * Create local tracks of specific types.
  8. *
  9. * @param {Object} options - The options with which the local tracks are to be
  10. * created.
  11. * @param {string|null} [options.cameraDeviceId] - Camera device id or
  12. * {@code undefined} to use app's settings.
  13. * @param {string[]} options.devices - Required track types such as 'audio'
  14. * and/or 'video'.
  15. * @param {string|null} [options.micDeviceId] - Microphone device id or
  16. * {@code undefined} to use app's settings.
  17. * @param {number|undefined} [options.timeout] - A timeout for JitsiMeetJS.createLocalTracks used to create the tracks.
  18. * @param {IStore} store - The redux store in the context of which the function
  19. * is to execute and from which state such as {@code config} is to be retrieved.
  20. * @returns {Promise<JitsiLocalTrack[]>}
  21. */
  22. export function createLocalTracksF(options: ITrackOptions = {}, store: IStore) {
  23. const { cameraDeviceId, micDeviceId } = options;
  24. const state = store.getState();
  25. const {
  26. resolution
  27. } = state['features/base/config'];
  28. const constraints = options.constraints ?? state['features/base/config'].constraints;
  29. return JitsiMeetJS.createLocalTracks(
  30. {
  31. cameraDeviceId,
  32. constraints,
  33. // Copy array to avoid mutations inside library.
  34. devices: options.devices?.slice(0),
  35. facingMode: options.facingMode || getCameraFacingMode(state),
  36. micDeviceId,
  37. resolution
  38. });
  39. }