"Fossies" - the Fresh Open Source Software Archive 
Member "jitsi-meet-7547/react/features/app/functions.any.ts" (25 Sep 2023, 1043 Bytes) of package /linux/misc/jitsi-meet-7547.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
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 /**
8 * Adds the current track state to the passed URL.
9 *
10 * @param {URL} url - The URL that will be modified.
11 * @param {Function|Object} stateful - The redux store or {@code getState} function.
12 * @returns {URL} - Returns the modified URL.
13 */
14 export function addTrackStateToURL(url: string, stateful: IStateful) {
15 const state = toState(stateful);
16 const tracks = state['features/base/tracks'];
17 const isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
18 const isAudioMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.AUDIO);
19
20 return addHashParamsToURL(new URL(url), { // use new URL object in order to not pollute the passed parameter.
21 'config.startWithAudioMuted': isAudioMuted,
22 'config.startWithVideoMuted': isVideoMuted
23 });
24
25 }