@livekit/components-js-docs 0.1.56 → 0.1.58
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.
- package/generated-docs/react/component/livekitroom.md +1 -1
- package/generated-docs/react/hook/usedatachannel.md +12 -1
- package/generated-docs/react/hook/uselivekitroom.md +1 -1
- package/generated-docs/react/index.md +2 -2
- package/generated-docs/react/livekitroomprops.md +17 -17
- package/generated-docs/react/livekitroomprops.onmediadevicefailure.md +1 -1
- package/generated-docs/react/meta-data.json +1 -1
- package/package.json +2 -2
- package/generated-docs/core/participantattributesobserver_1.md +0 -19
- package/generated-docs/react/hook/usedatachannel_1.md +0 -42
- package/generated-docs/react/hook/useremoteparticipant_1.md +0 -44
|
@@ -72,7 +72,7 @@ _(Optional)_
|
|
|
72
72
|
|
|
73
73
|
{% /parameter %}
|
|
74
74
|
|
|
75
|
-
{% parameter name="onMediaDeviceFailure" type="(failure?: MediaDeviceFailure) => void" optional=true %}
|
|
75
|
+
{% parameter name="onMediaDeviceFailure" type="(failure?: MediaDeviceFailure, kind?: MediaDeviceKind) => void" optional=true %}
|
|
76
76
|
_(Optional)_
|
|
77
77
|
|
|
78
78
|
{% /parameter %}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
# useDataChannel
|
|
11
11
|
|
|
12
|
-
The `useDataChannel` hook returns the ability to send and receive messages.
|
|
12
|
+
The `useDataChannel` hook returns the ability to send and receive messages. Pass an optional `topic` to narrow down which messages are returned in the messages array.
|
|
13
13
|
|
|
14
14
|
## Import
|
|
15
15
|
|
|
@@ -23,6 +23,8 @@ There is only one data channel. Passing a `topic` does not open a new data chann
|
|
|
23
23
|
|
|
24
24
|
## Usage
|
|
25
25
|
|
|
26
|
+
### Example 1
|
|
27
|
+
|
|
26
28
|
```tsx
|
|
27
29
|
// Send messages to all participants via the 'chat' topic.
|
|
28
30
|
const { message: latestMessage, send } = useDataChannel("chat", (msg) =>
|
|
@@ -30,6 +32,15 @@ const { message: latestMessage, send } = useDataChannel("chat", (msg) =>
|
|
|
30
32
|
);
|
|
31
33
|
```
|
|
32
34
|
|
|
35
|
+
### Example 2
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
// Receive all messages (no topic filtering)
|
|
39
|
+
const { message: latestMessage, send } = useDataChannel((msg) =>
|
|
40
|
+
console.log("message received", msg)
|
|
41
|
+
);
|
|
42
|
+
```
|
|
43
|
+
|
|
33
44
|
## Properties
|
|
34
45
|
|
|
35
46
|
{% parameter name="topic" type="T" optional=false %}
|
|
@@ -63,7 +63,7 @@ Define options how to connect to the LiveKit server.
|
|
|
63
63
|
{% parameter name="props.onError" type="(error: Error) => void" optional=true %}
|
|
64
64
|
{% /parameter %}
|
|
65
65
|
|
|
66
|
-
{% parameter name="props.onMediaDeviceFailure" type="(failure?: MediaDeviceFailure) => void" optional=true %}
|
|
66
|
+
{% parameter name="props.onMediaDeviceFailure" type="(failure?: MediaDeviceFailure, kind?: MediaDeviceKind) => void" optional=true %}
|
|
67
67
|
{% /parameter %}
|
|
68
68
|
|
|
69
69
|
{% parameter name="props.options" type="RoomOptions" optional=true %}
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
| [useConnectionQualityIndicator(options)](./react/hook/useconnectionqualityindicator.md) | The <code>useConnectionQualityIndicator</code> hook provides props for the <code>ConnectionQualityIndicator</code> or your custom implementation of it component. |
|
|
72
72
|
| [useConnectionState(room)](./react/hook/useconnectionstate.md) | The <code>useConnectionState</code> hook allows you to simply implement your own <code>ConnectionState</code> component. |
|
|
73
73
|
| [useCreateLayoutContext()](./react/hook/usecreatelayoutcontext.md) | |
|
|
74
|
-
| [useDataChannel(topic, onMessage)](./react/hook/usedatachannel.md) | The <code>useDataChannel</code> hook returns the ability to send and receive messages.
|
|
75
|
-
| [useDataChannel(onMessage)](./react/hook/usedatachannel_1.md) |
|
|
74
|
+
| [useDataChannel(topic, onMessage)](./react/hook/usedatachannel.md) | The <code>useDataChannel</code> hook returns the ability to send and receive messages. Pass an optional <code>topic</code> to narrow down which messages are returned in the messages array. |
|
|
75
|
+
| [useDataChannel(onMessage)](./react/hook/usedatachannel_1.md) | Overload for <code>useDataChannel</code> without a topic. See [useDataChannel()](./react/hook/usedatachannel.md) for information and usage examples. |
|
|
76
76
|
| [useDisconnectButton(props)](./react/hook/usedisconnectbutton.md) | The <code>useDisconnectButton</code> hook is used to implement the <code>DisconnectButton</code> or your custom implementation of it. It adds onClick handler to the button to disconnect from the room. |
|
|
77
77
|
| [useEnsureCreateLayoutContext(layoutContext)](./react/hook/useensurecreatelayoutcontext.md) | |
|
|
78
78
|
| [useEnsureLayoutContext(layoutContext)](./react/hook/useensurelayoutcontext.md) | Ensures that a layout context is provided, either via context or explicitly as a parameter. If not inside a <code>LayoutContext</code> and no layout context is provided, an error is thrown. |
|
|
@@ -19,20 +19,20 @@ export interface LiveKitRoomProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
19
19
|
|
|
20
20
|
## Properties
|
|
21
21
|
|
|
22
|
-
| Property | Type
|
|
23
|
-
| ------------------------------------------------------------------------- |
|
|
24
|
-
| [audio?](./react/livekitroomprops.audio.md) | AudioCaptureOptions \| boolean
|
|
25
|
-
| [connect?](./react/livekitroomprops.connect.md) | boolean
|
|
26
|
-
| [connectOptions?](./react/livekitroomprops.connectoptions.md) | RoomConnectOptions
|
|
27
|
-
| [onConnected?](./react/livekitroomprops.onconnected.md) | () => void
|
|
28
|
-
| [onDisconnected?](./react/livekitroomprops.ondisconnected.md) | (reason?: DisconnectReason) => void
|
|
29
|
-
| [onEncryptionError?](./react/livekitroomprops.onencryptionerror.md) | (error: Error) => void
|
|
30
|
-
| [onError?](./react/livekitroomprops.onerror.md) | (error: Error) => void
|
|
31
|
-
| [onMediaDeviceFailure?](./react/livekitroomprops.onmediadevicefailure.md) | (failure?: MediaDeviceFailure) => void | _(Optional)_ |
|
|
32
|
-
| [options?](./react/livekitroomprops.options.md) | RoomOptions
|
|
33
|
-
| [room?](./react/livekitroomprops.room.md) | Room
|
|
34
|
-
| [screen?](./react/livekitroomprops.screen.md) | ScreenShareCaptureOptions \| boolean
|
|
35
|
-
| [serverUrl](./react/livekitroomprops.serverurl.md) | string \| undefined
|
|
36
|
-
| [simulateParticipants?](./react/livekitroomprops.simulateparticipants.md) | number \| undefined
|
|
37
|
-
| [token](./react/livekitroomprops.token.md) | string \| undefined
|
|
38
|
-
| [video?](./react/livekitroomprops.video.md) | VideoCaptureOptions \| boolean
|
|
22
|
+
| Property | Type | Description |
|
|
23
|
+
| ------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
+
| [audio?](./react/livekitroomprops.audio.md) | AudioCaptureOptions \| boolean | _(Optional)_ Publish audio immediately after connecting to your LiveKit room. |
|
|
25
|
+
| [connect?](./react/livekitroomprops.connect.md) | boolean | _(Optional)_ If set to true a connection to LiveKit room is initiated. |
|
|
26
|
+
| [connectOptions?](./react/livekitroomprops.connectoptions.md) | RoomConnectOptions | _(Optional)_ Define options how to connect to the LiveKit server. |
|
|
27
|
+
| [onConnected?](./react/livekitroomprops.onconnected.md) | () => void | _(Optional)_ |
|
|
28
|
+
| [onDisconnected?](./react/livekitroomprops.ondisconnected.md) | (reason?: DisconnectReason) => void | _(Optional)_ |
|
|
29
|
+
| [onEncryptionError?](./react/livekitroomprops.onencryptionerror.md) | (error: Error) => void | _(Optional)_ |
|
|
30
|
+
| [onError?](./react/livekitroomprops.onerror.md) | (error: Error) => void | _(Optional)_ |
|
|
31
|
+
| [onMediaDeviceFailure?](./react/livekitroomprops.onmediadevicefailure.md) | (failure?: MediaDeviceFailure, kind?: MediaDeviceKind) => void | _(Optional)_ |
|
|
32
|
+
| [options?](./react/livekitroomprops.options.md) | RoomOptions | _(Optional)_ Options for when creating a new room. When you pass your own room instance to this component, these options have no effect. Instead, set the options directly in the room instance. |
|
|
33
|
+
| [room?](./react/livekitroomprops.room.md) | Room | _(Optional)_ Optional room instance. By passing your own room instance you overwrite the <code>options</code> parameter, make sure to set the options directly on the room instance itself. |
|
|
34
|
+
| [screen?](./react/livekitroomprops.screen.md) | ScreenShareCaptureOptions \| boolean | _(Optional)_ Publish screen share immediately after connecting to your LiveKit room. |
|
|
35
|
+
| [serverUrl](./react/livekitroomprops.serverurl.md) | string \| undefined | URL to the LiveKit server. For example: <code>wss://<domain>.livekit.cloud</code> To simplify the implementation, <code>undefined</code> is also accepted as an intermediate value, but only with a valid string url can the connection be established. |
|
|
36
|
+
| [simulateParticipants?](./react/livekitroomprops.simulateparticipants.md) | number \| undefined | _(Optional)_ |
|
|
37
|
+
| [token](./react/livekitroomprops.token.md) | string \| undefined | A user specific access token for a client to authenticate to the room. This token is necessary to establish a connection to the room. To simplify the implementation, <code>undefined</code> is also accepted as an intermediate value, but only with a valid string token can the connection be established. |
|
|
38
|
+
| [video?](./react/livekitroomprops.video.md) | VideoCaptureOptions \| boolean | _(Optional)_ Publish video immediately after connecting to your LiveKit room. |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"components":[{"filename":"audioconference.md","title":"AudioConference"},{"filename":"audiotrack.md","title":"AudioTrack"},{"filename":"audiovisualizer.md","title":"AudioVisualizer"},{"filename":"barvisualizer.md","title":"BarVisualizer"},{"filename":"carousellayout.md","title":"CarouselLayout"},{"filename":"chat.md","title":"Chat"},{"filename":"chatentry.md","title":"ChatEntry"},{"filename":"chattoggle.md","title":"ChatToggle"},{"filename":"clearpinbutton.md","title":"ClearPinButton"},{"filename":"connectionqualityindicator.md","title":"ConnectionQualityIndicator"},{"filename":"connectionstate.md","title":"ConnectionState"},{"filename":"connectionstatetoast.md","title":"ConnectionStateToast"},{"filename":"controlbar.md","title":"ControlBar"},{"filename":"disconnectbutton.md","title":"DisconnectButton"},{"filename":"focuslayout.md","title":"FocusLayout"},{"filename":"focuslayoutcontainer.md","title":"FocusLayoutContainer"},{"filename":"focustoggle.md","title":"FocusToggle"},{"filename":"gridlayout.md","title":"GridLayout"},{"filename":"layoutcontext.md","title":"LayoutContext"},{"filename":"layoutcontextprovider.md","title":"LayoutContextProvider"},{"filename":"livekitroom.md","title":"LiveKitRoom"},{"filename":"mediadevicemenu.md","title":"MediaDeviceMenu"},{"filename":"mediadeviceselect.md","title":"MediaDeviceSelect"},{"filename":"participantaudiotile.md","title":"ParticipantAudioTile"},{"filename":"participantcontext.md","title":"ParticipantContext"},{"filename":"participantcontextifneeded.md","title":"ParticipantContextIfNeeded"},{"filename":"participantloop.md","title":"ParticipantLoop"},{"filename":"participantname.md","title":"ParticipantName"},{"filename":"participanttile.md","title":"ParticipantTile"},{"filename":"prejoin.md","title":"PreJoin"},{"filename":"roomaudiorenderer.md","title":"RoomAudioRenderer"},{"filename":"roomcontext.md","title":"RoomContext"},{"filename":"roomname.md","title":"RoomName"},{"filename":"startaudio.md","title":"StartAudio"},{"filename":"startmediabutton.md","title":"StartMediaButton"},{"filename":"toast.md","title":"Toast"},{"filename":"trackloop.md","title":"TrackLoop"},{"filename":"trackmutedindicator.md","title":"TrackMutedIndicator"},{"filename":"trackrefcontext.md","title":"TrackRefContext"},{"filename":"tracktoggle.md","title":"TrackToggle"},{"filename":"videoconference.md","title":"VideoConference"},{"filename":"videotrack.md","title":"VideoTrack"},{"filename":"voiceassistantcontrolbar.md","title":"VoiceAssistantControlBar"}],"hooks":[{"filename":"useaudioplayback.md","title":"useAudioPlayback"},{"filename":"useaudiowaveform.md","title":"useAudioWaveform"},{"filename":"usechat.md","title":"useChat"},{"filename":"usechattoggle.md","title":"useChatToggle"},{"filename":"useclearpinbutton.md","title":"useClearPinButton"},{"filename":"useconnectionqualityindicator.md","title":"useConnectionQualityIndicator"},{"filename":"useconnectionstate.md","title":"useConnectionState"},{"filename":"usecreatelayoutcontext.md","title":"useCreateLayoutContext"},{"filename":"usedatachannel.md","title":"useDataChannel"},{"filename":"
|
|
1
|
+
{"components":[{"filename":"audioconference.md","title":"AudioConference"},{"filename":"audiotrack.md","title":"AudioTrack"},{"filename":"audiovisualizer.md","title":"AudioVisualizer"},{"filename":"barvisualizer.md","title":"BarVisualizer"},{"filename":"carousellayout.md","title":"CarouselLayout"},{"filename":"chat.md","title":"Chat"},{"filename":"chatentry.md","title":"ChatEntry"},{"filename":"chattoggle.md","title":"ChatToggle"},{"filename":"clearpinbutton.md","title":"ClearPinButton"},{"filename":"connectionqualityindicator.md","title":"ConnectionQualityIndicator"},{"filename":"connectionstate.md","title":"ConnectionState"},{"filename":"connectionstatetoast.md","title":"ConnectionStateToast"},{"filename":"controlbar.md","title":"ControlBar"},{"filename":"disconnectbutton.md","title":"DisconnectButton"},{"filename":"focuslayout.md","title":"FocusLayout"},{"filename":"focuslayoutcontainer.md","title":"FocusLayoutContainer"},{"filename":"focustoggle.md","title":"FocusToggle"},{"filename":"gridlayout.md","title":"GridLayout"},{"filename":"layoutcontext.md","title":"LayoutContext"},{"filename":"layoutcontextprovider.md","title":"LayoutContextProvider"},{"filename":"livekitroom.md","title":"LiveKitRoom"},{"filename":"mediadevicemenu.md","title":"MediaDeviceMenu"},{"filename":"mediadeviceselect.md","title":"MediaDeviceSelect"},{"filename":"participantaudiotile.md","title":"ParticipantAudioTile"},{"filename":"participantcontext.md","title":"ParticipantContext"},{"filename":"participantcontextifneeded.md","title":"ParticipantContextIfNeeded"},{"filename":"participantloop.md","title":"ParticipantLoop"},{"filename":"participantname.md","title":"ParticipantName"},{"filename":"participanttile.md","title":"ParticipantTile"},{"filename":"prejoin.md","title":"PreJoin"},{"filename":"roomaudiorenderer.md","title":"RoomAudioRenderer"},{"filename":"roomcontext.md","title":"RoomContext"},{"filename":"roomname.md","title":"RoomName"},{"filename":"startaudio.md","title":"StartAudio"},{"filename":"startmediabutton.md","title":"StartMediaButton"},{"filename":"toast.md","title":"Toast"},{"filename":"trackloop.md","title":"TrackLoop"},{"filename":"trackmutedindicator.md","title":"TrackMutedIndicator"},{"filename":"trackrefcontext.md","title":"TrackRefContext"},{"filename":"tracktoggle.md","title":"TrackToggle"},{"filename":"videoconference.md","title":"VideoConference"},{"filename":"videotrack.md","title":"VideoTrack"},{"filename":"voiceassistantcontrolbar.md","title":"VoiceAssistantControlBar"}],"hooks":[{"filename":"useaudioplayback.md","title":"useAudioPlayback"},{"filename":"useaudiowaveform.md","title":"useAudioWaveform"},{"filename":"usechat.md","title":"useChat"},{"filename":"usechattoggle.md","title":"useChatToggle"},{"filename":"useclearpinbutton.md","title":"useClearPinButton"},{"filename":"useconnectionqualityindicator.md","title":"useConnectionQualityIndicator"},{"filename":"useconnectionstate.md","title":"useConnectionState"},{"filename":"usecreatelayoutcontext.md","title":"useCreateLayoutContext"},{"filename":"usedatachannel.md","title":"useDataChannel"},{"filename":"usedisconnectbutton.md","title":"useDisconnectButton"},{"filename":"useensurecreatelayoutcontext.md","title":"useEnsureCreateLayoutContext"},{"filename":"useensurelayoutcontext.md","title":"useEnsureLayoutContext"},{"filename":"useensureparticipant.md","title":"useEnsureParticipant"},{"filename":"useensureroom.md","title":"useEnsureRoom"},{"filename":"useensuretrackref.md","title":"useEnsureTrackRef"},{"filename":"usefacingmode.md","title":"useFacingMode"},{"filename":"usefocustoggle.md","title":"useFocusToggle"},{"filename":"usegridlayout.md","title":"useGridLayout"},{"filename":"useisencrypted.md","title":"useIsEncrypted"},{"filename":"useismuted.md","title":"useIsMuted"},{"filename":"useisrecording.md","title":"useIsRecording"},{"filename":"useisspeaking.md","title":"useIsSpeaking"},{"filename":"usekrispnoisefilter.md","title":"useKrispNoiseFilter"},{"filename":"uselayoutcontext.md","title":"useLayoutContext"},{"filename":"uselivekitroom.md","title":"useLiveKitRoom"},{"filename":"uselocalparticipant.md","title":"useLocalParticipant"},{"filename":"uselocalparticipantpermissions.md","title":"useLocalParticipantPermissions"},{"filename":"usemaybelayoutcontext.md","title":"useMaybeLayoutContext"},{"filename":"usemaybeparticipantcontext.md","title":"useMaybeParticipantContext"},{"filename":"usemayberoomcontext.md","title":"useMaybeRoomContext"},{"filename":"usemaybetrackrefcontext.md","title":"useMaybeTrackRefContext"},{"filename":"usemediadevices.md","title":"useMediaDevices"},{"filename":"usemediadeviceselect.md","title":"useMediaDeviceSelect"},{"filename":"usemultibandtrackvolume.md","title":"useMultibandTrackVolume"},{"filename":"usepagination.md","title":"usePagination"},{"filename":"useparticipantattribute.md","title":"useParticipantAttribute"},{"filename":"useparticipantattributes.md","title":"useParticipantAttributes"},{"filename":"useparticipantcontext.md","title":"useParticipantContext"},{"filename":"useparticipantinfo.md","title":"useParticipantInfo"},{"filename":"useparticipantpermissions.md","title":"useParticipantPermissions"},{"filename":"useparticipants.md","title":"useParticipants"},{"filename":"useparticipanttile.md","title":"useParticipantTile"},{"filename":"useparticipanttracks.md","title":"useParticipantTracks"},{"filename":"usepersistentuserchoices.md","title":"usePersistentUserChoices"},{"filename":"usepinnedtracks.md","title":"usePinnedTracks"},{"filename":"usepreviewdevice.md","title":"usePreviewDevice"},{"filename":"usepreviewtracks.md","title":"usePreviewTracks"},{"filename":"useremoteparticipant.md","title":"useRemoteParticipant"},{"filename":"useremoteparticipants.md","title":"useRemoteParticipants"},{"filename":"useroomcontext.md","title":"useRoomContext"},{"filename":"useroominfo.md","title":"useRoomInfo"},{"filename":"usesortedparticipants.md","title":"useSortedParticipants"},{"filename":"usespeakingparticipants.md","title":"useSpeakingParticipants"},{"filename":"usestartaudio.md","title":"useStartAudio"},{"filename":"usestartvideo.md","title":"useStartVideo"},{"filename":"useswipe.md","title":"useSwipe"},{"filename":"usetextstream.md","title":"useTextStream"},{"filename":"usetoken.md","title":"useToken"},{"filename":"usetrackbyname.md","title":"useTrackByName"},{"filename":"usetrackmutedindicator.md","title":"useTrackMutedIndicator"},{"filename":"usetrackrefcontext.md","title":"useTrackRefContext"},{"filename":"usetracks.md","title":"useTracks"},{"filename":"usetracktoggle.md","title":"useTrackToggle"},{"filename":"usetracktranscription.md","title":"useTrackTranscription"},{"filename":"usetrackvolume.md","title":"useTrackVolume"},{"filename":"usevisualstableupdate.md","title":"useVisualStableUpdate"},{"filename":"usevoiceassistant.md","title":"useVoiceAssistant"}]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livekit/components-js-docs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.58",
|
|
4
4
|
"description": "Automatically generated documentation pages for LiveKit Components JS. Intended to be consumed by the documentation page.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"directory": "/docs/beta-docs"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@livekit/components-react": "2.9.
|
|
11
|
+
"@livekit/components-react": "2.9.5"
|
|
12
12
|
},
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "Apache-2.0",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
{
|
|
3
|
-
"title": "participantAttributesObserver",
|
|
4
|
-
"linkToSource": "https://github.com/livekit/components-js/blob/main/packages/core/src/observables/participant.ts"
|
|
5
|
-
}
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
9
|
-
|
|
10
|
-
# participantAttributesObserver
|
|
11
|
-
|
|
12
|
-
**Signature:**
|
|
13
|
-
|
|
14
|
-
```typescript
|
|
15
|
-
export declare function participantAttributesObserver(participant: undefined): Observable<{
|
|
16
|
-
changed: undefined;
|
|
17
|
-
attributes: undefined;
|
|
18
|
-
}>;
|
|
19
|
-
```
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
{
|
|
3
|
-
"title": "useDataChannel",
|
|
4
|
-
"linkToSource": "https://github.com/livekit/components-js/blob/main/packages/react/src/hooks/useDataChannel.ts"
|
|
5
|
-
}
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
9
|
-
|
|
10
|
-
# useDataChannel
|
|
11
|
-
|
|
12
|
-
The `useDataChannel` hook returns the ability to send and receive messages.
|
|
13
|
-
|
|
14
|
-
## Import
|
|
15
|
-
|
|
16
|
-
```typescript
|
|
17
|
-
import { useDataChannel } from "@livekit/components-react";
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Remarks
|
|
21
|
-
|
|
22
|
-
There is only one data channel. Passing a `topic` does not open a new data channel. It is only used to filter out messages with no or a different `topic`<!-- -->.
|
|
23
|
-
|
|
24
|
-
## Usage
|
|
25
|
-
|
|
26
|
-
```tsx
|
|
27
|
-
// Send messages to all participants
|
|
28
|
-
const { message: latestMessage, send } = useDataChannel("chat", (msg) =>
|
|
29
|
-
console.log("message received", msg)
|
|
30
|
-
);
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Properties
|
|
34
|
-
|
|
35
|
-
{% parameter name="onMessage" type="(msg: ReceivedDataMessage) => void" optional=true %}
|
|
36
|
-
{% /parameter %}
|
|
37
|
-
|
|
38
|
-
## Returns
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
UseDataChannelReturnType;
|
|
42
|
-
```
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
{
|
|
3
|
-
"title": "useRemoteParticipant",
|
|
4
|
-
"linkToSource": "https://github.com/livekit/components-js/blob/main/packages/react/src/hooks/useRemoteParticipant.ts"
|
|
5
|
-
}
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
9
|
-
|
|
10
|
-
# useRemoteParticipant
|
|
11
|
-
|
|
12
|
-
The `useRemoteParticipant` hook returns the first RemoteParticipant by either identity or based on the participant kind.
|
|
13
|
-
|
|
14
|
-
## Import
|
|
15
|
-
|
|
16
|
-
```typescript
|
|
17
|
-
import { useRemoteParticipant } from "@livekit/components-react";
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Remarks
|
|
21
|
-
|
|
22
|
-
To optimize performance, you can use the `updateOnlyOn` property to decide on what `ParticipantEvents` the hook updates.
|
|
23
|
-
|
|
24
|
-
## Usage
|
|
25
|
-
|
|
26
|
-
```tsx
|
|
27
|
-
const participant = useRemoteParticipant("Russ");
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Properties
|
|
31
|
-
|
|
32
|
-
{% parameter name="identity" type="string" optional=false %}
|
|
33
|
-
{% /parameter %}
|
|
34
|
-
|
|
35
|
-
{% parameter name="options.updateOnlyOn" type="ParticipantEvent[]" optional=true %}
|
|
36
|
-
To optimize performance, you can use the `updateOnlyOn` property to decide on what `ParticipantEvents` the hook updates. By default it updates on all relevant ParticipantEvents to keep the returned participant up to date.
|
|
37
|
-
|
|
38
|
-
{% /parameter %}
|
|
39
|
-
|
|
40
|
-
## Returns
|
|
41
|
-
|
|
42
|
-
```typescript
|
|
43
|
-
RemoteParticipant | undefined;
|
|
44
|
-
```
|