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

functions.native.ts 1.7KB

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