@livekit/components-core
Advanced tools
Comparing version 0.10.3 to 0.10.4
@@ -15,2 +15,3 @@ import type { AudioCaptureOptions } from 'livekit-client'; | ||
import type { ParticipantEventCallbacks } from 'livekit-client/dist/src/room/participant/Participant'; | ||
import type { ParticipantKind } from 'livekit-client'; | ||
import type { ParticipantPermission } from '@livekit/protocol'; | ||
@@ -311,2 +312,4 @@ import type { PublicationEventCallbacks } from 'livekit-client/dist/src/room/track/TrackPublication'; | ||
export declare function participantByIdentifierObserver(room: Room, { kind, identity }: ParticipantIdentifier, options?: ConnectedParticipantObserverOptions): Observable<RemoteParticipant | undefined>; | ||
/** @internal */ | ||
@@ -322,2 +325,10 @@ export declare interface ParticipantClickEvent { | ||
/** | ||
* @beta | ||
*/ | ||
export declare type ParticipantIdentifier = RequireAtLeastOne<{ | ||
kind: ParticipantKind; | ||
identity: string; | ||
}, 'identity' | 'kind'>; | ||
export declare function participantInfoObserver(participant: Participant): Observable<{ | ||
@@ -324,0 +335,0 @@ name: string | undefined; |
@@ -7,3 +7,3 @@ import type { ParticipantPermission } from '@livekit/protocol'; | ||
import type { TrackReferenceOrPlaceholder } from '../track-reference'; | ||
import type { TrackIdentifier } from '../types'; | ||
import type { ParticipantIdentifier, TrackIdentifier } from '../types'; | ||
export declare function observeParticipantEvents<T extends Participant>(participant: T, ...events: ParticipantEvent[]): Observable<T>; | ||
@@ -44,3 +44,4 @@ export interface ParticipantMedia<T extends Participant = Participant> { | ||
export declare function participantPermissionObserver(participant: Participant): Observable<ParticipantPermission | undefined>; | ||
export declare function participantByIdentifierObserver(room: Room, { kind, identity }: ParticipantIdentifier, options?: ConnectedParticipantObserverOptions): Observable<RemoteParticipant | undefined>; | ||
export {}; | ||
//# sourceMappingURL=participant.d.ts.map |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.43.1" | ||
"packageVersion": "7.47.0" | ||
} | ||
] | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { Participant, Track, TrackPublication } from 'livekit-client'; | ||
import type { Participant, ParticipantKind, Track, TrackPublication } from 'livekit-client'; | ||
import type { TrackReference, TrackReferenceOrPlaceholder } from './track-reference'; | ||
@@ -38,2 +38,9 @@ /** @public */ | ||
/** | ||
* @beta | ||
*/ | ||
export type ParticipantIdentifier = RequireAtLeastOne<{ | ||
kind: ParticipantKind; | ||
identity: string; | ||
}, 'identity' | 'kind'>; | ||
/** | ||
* The TrackIdentifier type is used to select Tracks either based on | ||
@@ -40,0 +47,0 @@ * - Track.Source and/or name of the track, e.g. `{source: Track.Source.Camera}` or `{name: "my-track"}` |
{ | ||
"name": "@livekit/components-core", | ||
"version": "0.10.3", | ||
"version": "0.10.4", | ||
"license": "Apache-2.0", | ||
@@ -28,3 +28,3 @@ "author": "LiveKit", | ||
"dependencies": { | ||
"@floating-ui/dom": "1.6.5", | ||
"@floating-ui/dom": "1.6.7", | ||
"loglevel": "1.9.1", | ||
@@ -34,3 +34,3 @@ "rxjs": "7.8.1" | ||
"peerDependencies": { | ||
"livekit-client": "^2.1.5", | ||
"livekit-client": "^2.2.0", | ||
"@livekit/protocol": "^1.16.0", | ||
@@ -37,0 +37,0 @@ "tslib": "^2.6.2" |
@@ -10,3 +10,3 @@ import type { ParticipantPermission } from '@livekit/protocol'; | ||
import type { TrackReferenceOrPlaceholder } from '../track-reference'; | ||
import type { TrackIdentifier } from '../types'; | ||
import type { ParticipantIdentifier, TrackIdentifier } from '../types'; | ||
import { observeRoomEvents } from './room'; | ||
@@ -252,1 +252,39 @@ | ||
} | ||
export function participantByIdentifierObserver( | ||
room: Room, | ||
{ kind, identity }: ParticipantIdentifier, | ||
options: ConnectedParticipantObserverOptions = {}, | ||
): Observable<RemoteParticipant | undefined> { | ||
const additionalEvents = options.additionalEvents ?? allParticipantEvents; | ||
const matchesIdentifier = (participant: RemoteParticipant) => { | ||
let isMatch = true; | ||
if (kind) { | ||
isMatch = isMatch && participant.kind === kind; | ||
} | ||
if (identity) { | ||
isMatch = isMatch && participant.identity === identity; | ||
} | ||
return isMatch; | ||
}; | ||
const observable = observeRoomEvents( | ||
room, | ||
RoomEvent.ParticipantConnected, | ||
RoomEvent.ParticipantDisconnected, | ||
RoomEvent.ConnectionStateChanged, | ||
).pipe( | ||
switchMap((r) => { | ||
const participant = Array.from(r.remoteParticipants.values()).find((p) => | ||
matchesIdentifier(p), | ||
); | ||
if (participant) { | ||
return observeParticipantEvents(participant, ...additionalEvents); | ||
} else { | ||
return new Observable<undefined>((subscribe) => subscribe.next(undefined)); | ||
} | ||
}), | ||
startWith(Array.from(room.remoteParticipants.values()).find((p) => matchesIdentifier(p))), | ||
); | ||
return observable; | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { Participant, Track, TrackPublication } from 'livekit-client'; | ||
import type { Participant, ParticipantKind, Track, TrackPublication } from 'livekit-client'; | ||
import type { TrackReference, TrackReferenceOrPlaceholder } from './track-reference'; | ||
@@ -61,2 +61,10 @@ | ||
/** | ||
* @beta | ||
*/ | ||
export type ParticipantIdentifier = RequireAtLeastOne< | ||
{ kind: ParticipantKind; identity: string }, | ||
'identity' | 'kind' | ||
>; | ||
/** | ||
* The TrackIdentifier type is used to select Tracks either based on | ||
@@ -63,0 +71,0 @@ * - Track.Source and/or name of the track, e.g. `{source: Track.Source.Camera}` or `{name: "my-track"}` |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
654340
8958
+ Added@floating-ui/dom@1.6.7(transitive)
+ Addedlivekit-client@2.9.1(transitive)
- Removed@floating-ui/dom@1.6.5(transitive)
- Removedlivekit-client@2.9.0(transitive)
Updated@floating-ui/dom@1.6.7