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 725B

123456789101112131415161718192021222324252627
  1. import { IStore } from '../../app/types';
  2. /**
  3. * Returns the location of the sounds. On Web it's the relative path to
  4. * the sounds folder placed in the source root.
  5. *
  6. * @returns {string}
  7. */
  8. export function getSoundsPath() {
  9. return 'sounds';
  10. }
  11. /**
  12. * Set new audio output device on the global sound elements.
  13. *
  14. * @param {string } deviceId - The new output deviceId.
  15. * @returns {Function}
  16. */
  17. export function setNewAudioOutputDevice(deviceId: string) {
  18. return function(_dispatch: IStore['dispatch'], getState: IStore['getState']) {
  19. const sounds = getState()['features/base/sounds'];
  20. for (const [ , sound ] of sounds) {
  21. sound.audioElement?.setSinkId?.(deviceId);
  22. }
  23. };
  24. }