Skip to content

Commit

Permalink
Deprecate useMediaTrackByName in favor of useTrackByName
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasIO committed Sep 8, 2023
1 parent 4144ddc commit 8bd6a0f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/react/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ export { UseTrackMutedIndicatorOptions, useTrackMutedIndicator } from './useTrac
export { UseTrackToggleProps, useTrackToggle } from './useTrackToggle';
export { UseTracksHookReturnType, UseTracksOptions, useTracks } from './useTracks';
export { UseVisualStableUpdateOptions, useVisualStableUpdate } from './useVisualStableUpdate';
export * from './useTrack';
export * from './useTrackByName';
5 changes: 4 additions & 1 deletion packages/react/src/hooks/useMediaTrackByName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { useEnsureParticipant } from '../context';
import type { UseMediaTrackOptions } from './useMediaTrack';
import { useMediaTrackBySourceOrName } from './useMediaTrackBySourceOrName';

/** @public */
/**
* @public
* @deprecated this function will be removed in a future version, use `useTrackByName` instead
*/
export function useMediaTrackByName(
name: string,
participant?: Participant,
Expand Down
16 changes: 16 additions & 0 deletions packages/react/src/hooks/useTrackByName.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { useEnsureTrackRef } from '../context';
import type { UseMediaTrackOptions } from './useMediaTrack';
import { useMediaTrackBySourceOrName } from './useMediaTrackBySourceOrName';
import type { TrackReferenceOrPlaceholder } from '@livekit/components-core';

/**
* @public
* @deprecated this function will be removed in a future version, use `useTrackByName` instead
*/
export function useMediaTrackByName(
trackRef?: TrackReferenceOrPlaceholder,
options: UseMediaTrackOptions = {},
) {
const ref = useEnsureTrackRef(trackRef);
return useMediaTrackBySourceOrName(ref, options);
}

0 comments on commit 8bd6a0f

Please sign in to comment.