@livekit/components-js-docs 0.0.4 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/generated-docs/core/encryptionstatusobservable.md +12 -0
  2. package/generated-docs/core/gettrackreferenceid.md +5 -1
  3. package/generated-docs/core/index.md +114 -109
  4. package/generated-docs/core/isparticipantsourcepinned.md +4 -0
  5. package/generated-docs/core/isparticipanttrackreferencepinned.md +16 -0
  6. package/generated-docs/core/mutedobserver.md +1 -4
  7. package/generated-docs/core/setupconnectionqualityindicator.md +1 -59
  8. package/generated-docs/core/setuptrackmutedindicator.md +1 -4
  9. package/generated-docs/core/trackreferenceid.md +9 -0
  10. package/generated-docs/react/audiotrackprops.md +9 -8
  11. package/generated-docs/react/audiotrackprops.name.md +6 -0
  12. package/generated-docs/react/audiotrackprops.participant.md +6 -0
  13. package/generated-docs/react/audiotrackprops.publication.md +6 -0
  14. package/generated-docs/react/audiotrackprops.source.md +7 -1
  15. package/generated-docs/react/audiotrackprops.trackref.md +13 -0
  16. package/generated-docs/react/audiovisualizerprops.md +4 -3
  17. package/generated-docs/react/audiovisualizerprops.participant.md +6 -0
  18. package/generated-docs/react/audiovisualizerprops.trackref.md +9 -0
  19. package/generated-docs/react/{carouselviewprops.children.md → carousellayoutprops.children.md} +1 -1
  20. package/generated-docs/react/carousellayoutprops.md +21 -0
  21. package/generated-docs/react/{carouselviewprops.orientation.md → carousellayoutprops.orientation.md} +1 -1
  22. package/generated-docs/react/{carouselviewprops.tracks.md → carousellayoutprops.tracks.md} +1 -1
  23. package/generated-docs/react/carouselview.md +15 -0
  24. package/generated-docs/react/chatprops.md +2 -2
  25. package/generated-docs/react/component/audiotrack.md +11 -4
  26. package/generated-docs/react/component/audiovisualizer.md +18 -1
  27. package/generated-docs/react/component/{carouselview.md → carousellayout.md} +8 -4
  28. package/generated-docs/react/component/chattoggle.md +5 -1
  29. package/generated-docs/react/component/clearpinbutton.md +3 -3
  30. package/generated-docs/react/component/connectionqualityindicator.md +1 -1
  31. package/generated-docs/react/component/connectionstate.md +1 -1
  32. package/generated-docs/react/component/connectionstatetoast.md +2 -0
  33. package/generated-docs/react/component/controlbar.md +1 -1
  34. package/generated-docs/react/component/disconnectbutton.md +1 -1
  35. package/generated-docs/react/component/focuslayout.md +7 -0
  36. package/generated-docs/react/component/focuslayoutcontainer.md +2 -0
  37. package/generated-docs/react/component/focustoggle.md +14 -3
  38. package/generated-docs/react/component/gridlayout.md +5 -1
  39. package/generated-docs/react/component/livekitroom.md +1 -1
  40. package/generated-docs/react/component/mediadevicemenu.md +1 -1
  41. package/generated-docs/react/component/mediadeviceselect.md +1 -1
  42. package/generated-docs/react/component/participantaudiotile.md +6 -1
  43. package/generated-docs/react/component/participantcontextifneeded.md +11 -1
  44. package/generated-docs/react/component/participantloop.md +1 -1
  45. package/generated-docs/react/component/participantname.md +1 -1
  46. package/generated-docs/react/component/participanttile.md +20 -5
  47. package/generated-docs/react/component/prejoin.md +7 -2
  48. package/generated-docs/react/component/roomaudiorenderer.md +1 -1
  49. package/generated-docs/react/component/roomname.md +1 -1
  50. package/generated-docs/react/component/startaudio.md +1 -1
  51. package/generated-docs/react/component/toast.md +9 -1
  52. package/generated-docs/react/component/trackloop.md +6 -6
  53. package/generated-docs/react/component/trackmutedindicator.md +11 -4
  54. package/generated-docs/react/component/tracktoggle.md +1 -1
  55. package/generated-docs/react/component/videoconference.md +2 -2
  56. package/generated-docs/react/component/videotrack.md +12 -5
  57. package/generated-docs/react/focuslayoutcontainerprops.focustrack.md +6 -0
  58. package/generated-docs/react/focuslayoutcontainerprops.participants.md +6 -0
  59. package/generated-docs/react/focuslayoutprops.md +5 -4
  60. package/generated-docs/react/focuslayoutprops.track.md +6 -0
  61. package/generated-docs/react/focuslayoutprops.trackref.md +13 -0
  62. package/generated-docs/react/focustoggleprops.md +5 -4
  63. package/generated-docs/react/focustoggleprops.participant.md +6 -0
  64. package/generated-docs/react/focustoggleprops.trackref.md +9 -0
  65. package/generated-docs/react/focustoggleprops.tracksource.md +7 -1
  66. package/generated-docs/react/hook/usechat.md +13 -1
  67. package/generated-docs/react/hook/usechattoggle.md +16 -1
  68. package/generated-docs/react/hook/useclearpinbutton.md +11 -1
  69. package/generated-docs/react/hook/useconnectionqualityindicator.md +17 -2
  70. package/generated-docs/react/hook/useconnectionstate.md +3 -1
  71. package/generated-docs/react/hook/usecreatelayoutcontext.md +3 -1
  72. package/generated-docs/react/hook/usedatachannel.md +17 -2
  73. package/generated-docs/react/hook/usedatachannel_1.md +17 -2
  74. package/generated-docs/react/hook/usedisconnectbutton.md +19 -2
  75. package/generated-docs/react/hook/useensurecreatelayoutcontext.md +3 -1
  76. package/generated-docs/react/hook/useensurelayoutcontext.md +3 -1
  77. package/generated-docs/react/hook/useensureparticipant.md +3 -1
  78. package/generated-docs/react/hook/useensureroom.md +3 -1
  79. package/generated-docs/react/hook/useensuretrackref.md +24 -0
  80. package/generated-docs/react/hook/useensuretrackreference.md +7 -1
  81. package/generated-docs/react/hook/usefocustoggle.md +20 -3
  82. package/generated-docs/react/hook/usegridlayout.md +13 -3
  83. package/generated-docs/react/hook/useismuted.md +13 -6
  84. package/generated-docs/react/hook/useismuted_1.md +29 -0
  85. package/generated-docs/react/hook/useisspeaking.md +12 -2
  86. package/generated-docs/react/hook/uselayoutcontext.md +3 -1
  87. package/generated-docs/react/hook/uselivekitroom.md +16 -2
  88. package/generated-docs/react/hook/uselocalparticipant.md +20 -3
  89. package/generated-docs/react/hook/uselocalparticipantpermissions.md +12 -2
  90. package/generated-docs/react/hook/usemaybelayoutcontext.md +3 -1
  91. package/generated-docs/react/hook/usemaybeparticipantcontext.md +3 -1
  92. package/generated-docs/react/hook/usemayberoomcontext.md +3 -1
  93. package/generated-docs/react/hook/usemaybetrackcontext.md +7 -1
  94. package/generated-docs/react/hook/usemaybetrackrefcontext.md +19 -0
  95. package/generated-docs/react/hook/usemediadevices.md +13 -2
  96. package/generated-docs/react/hook/usemediadeviceselect.md +19 -2
  97. package/generated-docs/react/hook/usemediatrack.md +13 -1
  98. package/generated-docs/react/hook/usemediatrackbyname.md +13 -1
  99. package/generated-docs/react/hook/useparticipantcontext.md +3 -1
  100. package/generated-docs/react/hook/useparticipantinfo.md +7 -1
  101. package/generated-docs/react/hook/useparticipantpermissions.md +3 -1
  102. package/generated-docs/react/hook/useparticipants.md +18 -3
  103. package/generated-docs/react/hook/useparticipanttile.md +12 -2
  104. package/generated-docs/react/hook/usepinnedtracks.md +16 -2
  105. package/generated-docs/react/hook/usepreviewdevice.md +7 -1
  106. package/generated-docs/react/hook/useremoteparticipant.md +16 -2
  107. package/generated-docs/react/hook/useremoteparticipants.md +18 -3
  108. package/generated-docs/react/hook/useroomcontext.md +3 -1
  109. package/generated-docs/react/hook/useroominfo.md +6 -1
  110. package/generated-docs/react/hook/usesortedparticipants.md +4 -2
  111. package/generated-docs/react/hook/usespeakingparticipants.md +11 -3
  112. package/generated-docs/react/hook/usetoken.md +12 -2
  113. package/generated-docs/react/hook/usetrack.md +31 -0
  114. package/generated-docs/react/hook/usetrackbyname.md +31 -0
  115. package/generated-docs/react/hook/usetrackcontext.md +8 -2
  116. package/generated-docs/react/hook/usetrackmutedindicator.md +13 -6
  117. package/generated-docs/react/hook/usetrackmutedindicator_1.md +29 -0
  118. package/generated-docs/react/hook/usetrackrefcontext.md +19 -0
  119. package/generated-docs/react/hook/usetracks.md +3 -1
  120. package/generated-docs/react/hook/usetracktoggle.md +19 -2
  121. package/generated-docs/react/hook/usevisualstableupdate.md +16 -7
  122. package/generated-docs/react/index.md +163 -155
  123. package/generated-docs/react/localuserchoices.md +2 -0
  124. package/generated-docs/react/meta-data.json +1 -1
  125. package/generated-docs/react/participanttileprops.md +8 -7
  126. package/generated-docs/react/participanttileprops.participant.md +6 -0
  127. package/generated-docs/react/participanttileprops.publication.md +6 -0
  128. package/generated-docs/react/participanttileprops.source.md +6 -0
  129. package/generated-docs/react/participanttileprops.trackref.md +13 -0
  130. package/generated-docs/react/prejoinprops.md +12 -11
  131. package/generated-docs/react/prejoinprops.showe2eeoptions.md +9 -0
  132. package/generated-docs/react/trackcontext.md +4 -0
  133. package/generated-docs/react/trackmutedindicatorprops.md +6 -5
  134. package/generated-docs/react/trackmutedindicatorprops.participant.md +6 -0
  135. package/generated-docs/react/trackmutedindicatorprops.source.md +7 -1
  136. package/generated-docs/react/trackmutedindicatorprops.trackref.md +9 -0
  137. package/generated-docs/react/trackrefcontext.md +13 -0
  138. package/generated-docs/react/usefocustoggleprops.md +6 -5
  139. package/generated-docs/react/usefocustoggleprops.participant.md +6 -0
  140. package/generated-docs/react/usefocustoggleprops.trackref.md +9 -0
  141. package/generated-docs/react/usefocustoggleprops.tracksource.md +7 -1
  142. package/generated-docs/react/useparticipantinfooptions.md +9 -1
  143. package/generated-docs/react/useparticipantpermissionsoptions.md +9 -1
  144. package/generated-docs/react/useparticipanttileprops.md +9 -8
  145. package/generated-docs/react/useparticipanttileprops.participant.md +7 -1
  146. package/generated-docs/react/useparticipanttileprops.publication.md +6 -0
  147. package/generated-docs/react/useparticipanttileprops.source.md +7 -1
  148. package/generated-docs/react/useparticipanttileprops.trackref.md +13 -0
  149. package/generated-docs/react/useremoteparticipantoptions.md +3 -3
  150. package/generated-docs/react/useremoteparticipantoptions.updateonlyon.md +4 -0
  151. package/generated-docs/react/useroominfooptions.md +13 -1
  152. package/generated-docs/react/usetrackmutedindicatoroptions.participant.md +6 -0
  153. package/generated-docs/react/usetrackoptions.element.md +9 -0
  154. package/generated-docs/react/usetrackoptions.md +18 -0
  155. package/generated-docs/react/usetrackoptions.props.md +9 -0
  156. package/generated-docs/react/videoconferenceprops.md +2 -2
  157. package/generated-docs/react/videotrackprops.md +10 -9
  158. package/generated-docs/react/videotrackprops.name.md +6 -0
  159. package/generated-docs/react/videotrackprops.participant.md +6 -0
  160. package/generated-docs/react/videotrackprops.publication.md +6 -0
  161. package/generated-docs/react/videotrackprops.source.md +7 -1
  162. package/generated-docs/react/videotrackprops.trackref.md +13 -0
  163. package/package.json +1 -1
  164. package/generated-docs/react/carouselviewprops.md +0 -21
  165. /package/generated-docs/{react → core}/messagedecoder.md +0 -0
  166. /package/generated-docs/{react → core}/messageencoder.md +0 -0
@@ -2,13 +2,25 @@
2
2
 
3
3
  # usePinnedTracks
4
4
 
5
+ The `usePinnedTracks` hook returns a array of the pinned tracks of the current room.
6
+
5
7
  ## Import
6
8
 
7
9
  ```typescript
8
10
  import { usePinnedTracks } from '@livekit/components-react';
9
11
  ```
10
12
 
11
- {% partial file="p_usage.md" variables={exampleCount: 0} /%}
13
+ ## Remarks
14
+
15
+ To function properly, this hook must be called within a `LayoutContext`<!-- -->.
16
+
17
+ ## Usage
18
+
19
+ ```tsx
20
+ const pinnedTracks = usePinnedTracks();
21
+ ```
22
+
23
+ {% partial file="p_usage.md" variables={exampleCount: 1} /%}
12
24
 
13
25
  ## Parameters
14
26
 
@@ -17,4 +29,6 @@ import { usePinnedTracks } from '@livekit/components-react';
17
29
 
18
30
  ## Returns
19
31
 
20
- `TrackReferenceOrPlaceholder[]`
32
+ ```typescript
33
+ TrackReferenceOrPlaceholder[]
34
+ ```
@@ -23,4 +23,10 @@ import { usePreviewDevice } from '@livekit/components-react';
23
23
 
24
24
  ## Returns
25
25
 
26
- `{ selectedDevice: MediaDeviceInfo | undefined; localTrack: T | undefined; deviceError: Error | null; }`
26
+ ```typescript
27
+ {
28
+ selectedDevice: MediaDeviceInfo | undefined;
29
+ localTrack: T | undefined;
30
+ deviceError: Error | null;
31
+ }
32
+ ```
@@ -2,13 +2,25 @@
2
2
 
3
3
  # useRemoteParticipant
4
4
 
5
+ The `useRemoteParticipant` hook returns the RemoteParticipant with the given `identity`<!-- -->.
6
+
5
7
  ## Import
6
8
 
7
9
  ```typescript
8
10
  import { useRemoteParticipant } from '@livekit/components-react';
9
11
  ```
10
12
 
11
- {% partial file="p_usage.md" variables={exampleCount: 0} /%}
13
+ ## Remarks
14
+
15
+ To optimize performance, you can use the `updateOnlyOn` property to decide on what `ParticipantEvents` the hook updates.
16
+
17
+ ## Usage
18
+
19
+ ```tsx
20
+ const participant = useRemoteParticipant('Russ');
21
+ ```
22
+
23
+ {% partial file="p_usage.md" variables={exampleCount: 1} /%}
12
24
 
13
25
  ## Parameters
14
26
 
@@ -20,4 +32,6 @@ import { useRemoteParticipant } from '@livekit/components-react';
20
32
 
21
33
  ## Returns
22
34
 
23
- `RemoteParticipant | undefined`
35
+ ```typescript
36
+ RemoteParticipant | undefined;
37
+ ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  # useRemoteParticipants
4
4
 
5
- The useRemoteParticipants
5
+ The `useRemoteParticipants` hook returns all remote participants (without the local) of the current room.
6
6
 
7
7
  ## Import
8
8
 
@@ -10,7 +10,20 @@ The useRemoteParticipants
10
10
  import { useRemoteParticipants } from '@livekit/components-react';
11
11
  ```
12
12
 
13
- {% partial file="p_usage.md" variables={exampleCount: 0} /%}
13
+ ## Remarks
14
+
15
+ To optimize performance, you can use the `updateOnlyOn` property to decide on what `RoomEvents` the hook updates.
16
+
17
+ ## Usage
18
+
19
+ ```tsx
20
+ const participants = useRemoteParticipants();
21
+ <ParticipantLoop participants={participants}>
22
+ <ParticipantName />
23
+ </ParticipantLoop>;
24
+ ```
25
+
26
+ {% partial file="p_usage.md" variables={exampleCount: 1} /%}
14
27
 
15
28
  ## Parameters
16
29
 
@@ -19,4 +32,6 @@ import { useRemoteParticipants } from '@livekit/components-react';
19
32
 
20
33
  ## Returns
21
34
 
22
- `RemoteParticipant[]`
35
+ ```typescript
36
+ RemoteParticipant[]
37
+ ```
@@ -14,4 +14,6 @@ import { useRoomContext } from '@livekit/components-react';
14
14
 
15
15
  ## Returns
16
16
 
17
- `Room`
17
+ ```typescript
18
+ Room;
19
+ ```
@@ -17,4 +17,9 @@ import { useRoomInfo } from '@livekit/components-react';
17
17
 
18
18
  ## Returns
19
19
 
20
- `{ name: string; metadata: string | undefined; }`
20
+ ```typescript
21
+ {
22
+ name: string;
23
+ metadata: string | undefined;
24
+ }
25
+ ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  # useSortedParticipants
4
4
 
5
- The useSortedParticipants hook returns the only the active speakers of all participants.
5
+ The `useSortedParticipants` hook returns the participants sorted by importance.
6
6
 
7
7
  ## Import
8
8
 
@@ -19,4 +19,6 @@ import { useSortedParticipants } from '@livekit/components-react';
19
19
 
20
20
  ## Returns
21
21
 
22
- `Participant[]`
22
+ ```typescript
23
+ Participant[]
24
+ ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  # useSpeakingParticipants
4
4
 
5
- The useSpeakingParticipants hook returns the only the active speakers of all participants.
5
+ The `useSpeakingParticipants` hook returns the only the active speakers of all participants.
6
6
 
7
7
  ## Import
8
8
 
@@ -10,8 +10,16 @@ The useSpeakingParticipants hook returns the only the active speakers of all par
10
10
  import { useSpeakingParticipants } from '@livekit/components-react';
11
11
  ```
12
12
 
13
- {% partial file="p_usage.md" variables={exampleCount: 0} /%}
13
+ ## Usage
14
+
15
+ ```tsx
16
+ const activeSpeakers = useSpeakingParticipants();
17
+ ```
18
+
19
+ {% partial file="p_usage.md" variables={exampleCount: 1} /%}
14
20
 
15
21
  ## Returns
16
22
 
17
- `import("livekit-client").Participant[]`
23
+ ```typescript
24
+ import("livekit-client").Participant[]
25
+ ```
@@ -2,13 +2,21 @@
2
2
 
3
3
  # useToken
4
4
 
5
+ The `useToken` hook fetches a token from the given token endpoint with the given user info.
6
+
5
7
  ## Import
6
8
 
7
9
  ```typescript
8
10
  import { useToken } from '@livekit/components-react';
9
11
  ```
10
12
 
11
- {% partial file="p_usage.md" variables={exampleCount: 0} /%}
13
+ ## Usage
14
+
15
+ ```tsx
16
+ const token = useToken(<token-endpoint>, roomName, { userInfo: { identity, name }});
17
+ ```
18
+
19
+ {% partial file="p_usage.md" variables={exampleCount: 1} /%}
12
20
 
13
21
  ## Parameters
14
22
 
@@ -23,4 +31,6 @@ import { useToken } from '@livekit/components-react';
23
31
 
24
32
  ## Returns
25
33
 
26
- `string | undefined`
34
+ ```typescript
35
+ string | undefined;
36
+ ```
@@ -0,0 +1,31 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ # useTrack
4
+
5
+ ## Import
6
+
7
+ ```typescript
8
+ import { useTrack } from '@livekit/components-react';
9
+ ```
10
+
11
+ {% partial file="p_usage.md" variables={exampleCount: 0} /%}
12
+
13
+ ## Parameters
14
+
15
+ {% parameter name="trackRef" type="TrackIdentifier" optional=false %}
16
+ {% /parameter %}
17
+
18
+ {% parameter name="options" type="UseTrackOptions" optional=true %}
19
+ {% /parameter %}
20
+
21
+ ## Returns
22
+
23
+ ```typescript
24
+ {
25
+ publication: import('livekit-client').TrackPublication | undefined;
26
+ isMuted: boolean | undefined;
27
+ isSubscribed: boolean | undefined;
28
+ track: import('livekit-client').Track | undefined;
29
+ elementProps: React.HTMLAttributes<HTMLElement>;
30
+ }
31
+ ```
@@ -0,0 +1,31 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ # useTrackByName
4
+
5
+ ## Import
6
+
7
+ ```typescript
8
+ import { useTrackByName } from '@livekit/components-react';
9
+ ```
10
+
11
+ {% partial file="p_usage.md" variables={exampleCount: 0} /%}
12
+
13
+ ## Parameters
14
+
15
+ {% parameter name="options" type="UseMediaTrackOptions" optional=true %}
16
+ {% /parameter %}
17
+
18
+ {% parameter name="trackRef" type="TrackReferenceOrPlaceholder" optional=true %}
19
+ {% /parameter %}
20
+
21
+ ## Returns
22
+
23
+ ```typescript
24
+ {
25
+ publication: import('livekit-client').TrackPublication | undefined;
26
+ isMuted: boolean | undefined;
27
+ isSubscribed: boolean | undefined;
28
+ track: import('livekit-client').Track | undefined;
29
+ elementProps: import('react').HTMLAttributes<HTMLElement>;
30
+ }
31
+ ```
@@ -2,7 +2,11 @@
2
2
 
3
3
  # useTrackContext
4
4
 
5
- Ensures that a track reference is provided via context. If not inside a `TrackContext`<!-- -->, an error is thrown.
5
+ > Warning: This API is now obsolete.
6
+ >
7
+ > `useTrackContext` has been to `useTrackRefContext`<!-- -->, use this as a drop in replacement.
8
+
9
+ Ensures that a track reference is provided via context. If not inside a `TrackRefContext`<!-- -->, an error is thrown.
6
10
 
7
11
  ## Import
8
12
 
@@ -14,4 +18,6 @@ import { useTrackContext } from '@livekit/components-react';
14
18
 
15
19
  ## Returns
16
20
 
17
- `TrackReferenceOrPlaceholder`
21
+ ```typescript
22
+ TrackReferenceOrPlaceholder;
23
+ ```
@@ -2,22 +2,29 @@
2
2
 
3
3
  # useTrackMutedIndicator
4
4
 
5
+ The `useTrackMutedIndicator` hook is used to implement the `TrackMutedIndicator` component and returns the muted state of the given track.
6
+
5
7
  ## Import
6
8
 
7
9
  ```typescript
8
10
  import { useTrackMutedIndicator } from '@livekit/components-react';
9
11
  ```
10
12
 
11
- {% partial file="p_usage.md" variables={exampleCount: 0} /%}
13
+ ## Usage
12
14
 
13
- ## Parameters
15
+ ```tsx
16
+ const { isMuted } = useTrackMutedIndicator(trackRef);
17
+ ```
14
18
 
15
- {% parameter name="source" type="Track.Source" optional=false %}
16
- {% /parameter %}
19
+ {% partial file="p_usage.md" variables={exampleCount: 1} /%}
17
20
 
18
- {% parameter name="options" type="UseTrackMutedIndicatorOptions" optional=true %}
21
+ ## Parameters
22
+
23
+ {% parameter name="trackRef" type="TrackReferenceOrPlaceholder" optional=true %}
19
24
  {% /parameter %}
20
25
 
21
26
  ## Returns
22
27
 
23
- `{ isMuted: boolean; className: string; }`
28
+ ```typescript
29
+ TrackMutedIndicatorReturnType;
30
+ ```
@@ -0,0 +1,29 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ # useTrackMutedIndicator
4
+
5
+ > Warning: This API is now obsolete.
6
+ >
7
+ > This overload will be removed in a future version, pass in trackRef instead.
8
+
9
+ ## Import
10
+
11
+ ```typescript
12
+ import { useTrackMutedIndicator } from '@livekit/components-react';
13
+ ```
14
+
15
+ {% partial file="p_usage.md" variables={exampleCount: 0} /%}
16
+
17
+ ## Parameters
18
+
19
+ {% parameter name="source" type="Track.Source" optional=false %}
20
+ {% /parameter %}
21
+
22
+ {% parameter name="options" type="UseTrackMutedIndicatorOptions" optional=true %}
23
+ {% /parameter %}
24
+
25
+ ## Returns
26
+
27
+ ```typescript
28
+ TrackMutedIndicatorReturnType;
29
+ ```
@@ -0,0 +1,19 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ # useTrackRefContext
4
+
5
+ Ensures that a track reference is provided via context. If not inside a `TrackRefContext`<!-- -->, an error is thrown.
6
+
7
+ ## Import
8
+
9
+ ```typescript
10
+ import { useTrackRefContext } from '@livekit/components-react';
11
+ ```
12
+
13
+ {% partial file="p_usage.md" variables={exampleCount: 0} /%}
14
+
15
+ ## Returns
16
+
17
+ ```typescript
18
+ TrackReferenceOrPlaceholder;
19
+ ```
@@ -39,4 +39,6 @@ const trackReferencesWithPlaceholders: TrackReferenceOrPlaceholder[] = useTracks
39
39
 
40
40
  ## Returns
41
41
 
42
- `UseTracksHookReturnType<T>`
42
+ ```typescript
43
+ UseTracksHookReturnType<T>;
44
+ ```
@@ -2,13 +2,22 @@
2
2
 
3
3
  # useTrackToggle
4
4
 
5
+ The `useTrackToggle` hook is used to implement the `TrackToggle` component and returns state and functionality of the given track.
6
+
5
7
  ## Import
6
8
 
7
9
  ```typescript
8
10
  import { useTrackToggle } from '@livekit/components-react';
9
11
  ```
10
12
 
11
- {% partial file="p_usage.md" variables={exampleCount: 0} /%}
13
+ ## Usage
14
+
15
+ ```tsx
16
+ const { buttonProps, enabled } = useTrackToggle(trackRef);
17
+ return <button {...buttonProps}>{enabled ? 'disable' : 'enable'}</button>;
18
+ ```
19
+
20
+ {% partial file="p_usage.md" variables={exampleCount: 1} /%}
12
21
 
13
22
  ## Parameters
14
23
 
@@ -17,4 +26,12 @@ import { useTrackToggle } from '@livekit/components-react';
17
26
 
18
27
  ## Returns
19
28
 
20
- `{ toggle: ((forceState?: boolean | undefined) => void) | ((forceState?: boolean | undefined, captureOptions?: import("@livekit/components-core").CaptureOptionsBySource<T> | undefined) => Promise<void>); enabled: boolean; pending: boolean; track: import("livekit-client").LocalTrackPublication | undefined; buttonProps: React.ButtonHTMLAttributes<HTMLButtonElement>; }`
29
+ ```typescript
30
+ {
31
+ toggle: ((forceState?: boolean | undefined) => void) | ((forceState?: boolean | undefined, captureOptions?: import("@livekit/components-core").CaptureOptionsBySource<T> | undefined) => Promise<void>);
32
+ enabled: boolean;
33
+ pending: boolean;
34
+ track: import("livekit-client").LocalTrackPublication | undefined;
35
+ buttonProps: React.ButtonHTMLAttributes<HTMLButtonElement>;
36
+ }
37
+ ```
@@ -2,11 +2,7 @@
2
2
 
3
3
  # useVisualStableUpdate
4
4
 
5
- > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
6
-
7
- The useVisualStableUpdate hook tries to keep visual updates of the TackBundles array to a minimum, while still trying to display important tiles such as speaking participants or screen shares.
8
-
9
- Updating works with pagination. For example, if a participant starts speaking on the second page, they will be moved to the first page by replacing the least active/interesting participant on the first page.
5
+ The `useVisualStableUpdate` hook is used to prevent visually jarring jumps and shifts of elements in an array. The algorithm only starts to update when there are more items than visually fit on a page. If this is the case, it will make sure that speaking participants move to the first page and are always visible. Updating the array can occur because attendees leave or join a room, or because they mute/unmute or start speaking.
10
6
 
11
7
  ## Import
12
8
 
@@ -14,7 +10,18 @@ Updating works with pagination. For example, if a participant starts speaking on
14
10
  import { useVisualStableUpdate } from '@livekit/components-react';
15
11
  ```
16
12
 
17
- {% partial file="p_usage.md" variables={exampleCount: 0} /%}
13
+ ## Remarks
14
+
15
+ The hook is used for the `GridLayout` and `CarouselLayout` components.
16
+
17
+ ## Usage
18
+
19
+ ```tsx
20
+ const trackRefs = useTracks();
21
+ const updatedTrackRefs = useVisualStableUpdate(trackRefs, itemPerPage);
22
+ ```
23
+
24
+ {% partial file="p_usage.md" variables={exampleCount: 1} /%}
18
25
 
19
26
  ## Parameters
20
27
 
@@ -29,4 +36,6 @@ import { useVisualStableUpdate } from '@livekit/components-react';
29
36
 
30
37
  ## Returns
31
38
 
32
- `TrackReferenceOrPlaceholder[]`
39
+ ```typescript
40
+ TrackReferenceOrPlaceholder[]
41
+ ```