Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

functions.any.ts 1.0KB

12345678910111213141516171819202122232425
  1. import { IStateful } from '../base/app/types';
  2. import { MEDIA_TYPE } from '../base/media/constants';
  3. import { toState } from '../base/redux/functions';
  4. import { isLocalTrackMuted } from '../base/tracks/functions';
  5. import { addHashParamsToURL } from '../base/util/uri';
  6. /**
  7. * Adds the current track state to the passed URL.
  8. *
  9. * @param {URL} url - The URL that will be modified.
  10. * @param {Function|Object} stateful - The redux store or {@code getState} function.
  11. * @returns {URL} - Returns the modified URL.
  12. */
  13. export function addTrackStateToURL(url: string, stateful: IStateful) {
  14. const state = toState(stateful);
  15. const tracks = state['features/base/tracks'];
  16. const isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
  17. const isAudioMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.AUDIO);
  18. return addHashParamsToURL(new URL(url), { // use new URL object in order to not pollute the passed parameter.
  19. 'config.startWithAudioMuted': isAudioMuted,
  20. 'config.startWithVideoMuted': isVideoMuted
  21. });
  22. }