@livekit/components-core
Version:
This package is a wrapper around the [livekit/client-sdk-js](https://github.com/livekit/client-sdk-js) package. It transforms the event based logic into simple to use observable state and component level APIs. This package is the core for all framework sp
26 lines (22 loc) • 959 B
text/typescript
// @ts-ignore some module resolutions (other than 'node') choke on this
import type { Styles } from '@livekit/components-styles/dist/types_unprefixed/index.scss';
import { Track } from 'livekit-client';
import { mutedObserver } from '../observables/participant';
import { prefixClass } from '../styles-interface';
import type { TrackReferenceOrPlaceholder } from '../track-reference';
export function setupTrackMutedIndicator(trackRef: TrackReferenceOrPlaceholder) {
let classForSource: keyof Styles = 'track-muted-indicator-camera';
switch (trackRef.source) {
case Track.Source.Camera:
classForSource = 'track-muted-indicator-camera';
break;
case Track.Source.Microphone:
classForSource = 'track-muted-indicator-microphone';
break;
default:
break;
}
const className: string = prefixClass(classForSource);
const mediaMutedObserver = mutedObserver(trackRef);
return { className, mediaMutedObserver };
}