@livekit/components-core
Advanced tools
Comparing version 0.10.1 to 0.10.2
@@ -17,2 +17,3 @@ import type { AudioCaptureOptions } from 'livekit-client'; | ||
import type { ParticipantPermission } from '@livekit/protocol'; | ||
import type { PublicationEventCallbacks } from 'livekit-client/dist/src/room/track/TrackPublication'; | ||
import { RemoteParticipant } from 'livekit-client'; | ||
@@ -28,2 +29,3 @@ import { Room } from 'livekit-client'; | ||
import type { TrackPublishOptions } from 'livekit-client'; | ||
import { TranscriptionSegment } from 'livekit-client'; | ||
import type { VideoCaptureOptions } from 'livekit-client'; | ||
@@ -33,2 +35,7 @@ | ||
export declare function addMediaTimestampToTranscription(segment: TranscriptionSegment, timestamps: { | ||
timestamp: number; | ||
rtpTimestamp?: number; | ||
}): ReceivedTranscriptionSegment; | ||
export declare const allParticipantEvents: ParticipantEvent[]; | ||
@@ -125,6 +132,18 @@ | ||
/** | ||
* @returns An array of unique (by id) `TranscriptionSegment`s. Latest wins. If the resulting array would be longer than `windowSize`, the array will be reduced to `windowSize` length | ||
*/ | ||
export declare function dedupeSegments<T extends TranscriptionSegment>(prevSegments: T[], newSegments: T[], windowSize: number): T[]; | ||
export declare const defaultUserChoices: LocalUserChoices; | ||
export declare function didActiveSegmentsChange<T extends TranscriptionSegment>(prevActive: T[], newActive: T[]): boolean; | ||
export declare function encryptionStatusObservable(room: Room, participant: Participant): Observable<boolean>; | ||
export declare function getActiveTranscriptionSegments(segments: ReceivedTranscriptionSegment[], syncTimes: { | ||
timestamp: number; | ||
rtpTimestamp?: number; | ||
}, maxAge?: number): ReceivedTranscriptionSegment[]; | ||
/** | ||
@@ -350,2 +369,7 @@ * Calculates the scrollbar width by creating two HTML elements | ||
export declare type ReceivedTranscriptionSegment = TranscriptionSegment & { | ||
receivedAtMediaTimestamp: number; | ||
receivedAt: number; | ||
}; | ||
declare interface RegExOptions { | ||
@@ -575,2 +599,4 @@ /** | ||
export declare function trackEventSelector<T extends TrackEvent_2>(publication: TrackPublication | Track, event: T): Observable<Parameters<PublicationEventCallbacks[Extract<T, keyof PublicationEventCallbacks>]>>; | ||
/** | ||
@@ -628,2 +654,6 @@ * The TrackIdentifier type is used to select Tracks either based on | ||
export declare function trackSyncTimeObserver(track: Track): Observable<number>; | ||
export declare function trackTranscriptionObserver(publication: TrackPublication): Observable<[transcription: TranscriptionSegment[]]>; | ||
declare type UpdatableItem = TrackReferenceOrPlaceholder | number; | ||
@@ -630,0 +660,0 @@ |
@@ -10,2 +10,3 @@ export * from './detectMobileBrowser'; | ||
export { supportsScreenSharing } from './featureDetection'; | ||
export * from './transcriptions'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -6,2 +6,3 @@ import type { Participant, Room, Track, TrackPublication } from 'livekit-client'; | ||
import type { ParticipantTrackIdentifier } from '../types'; | ||
import type { PublicationEventCallbacks } from 'livekit-client/dist/src/room/track/TrackPublication'; | ||
export declare function trackObservable(track: TrackPublication): Observable<TrackPublication>; | ||
@@ -18,3 +19,6 @@ export declare function observeTrackEvents(track: TrackPublication, ...events: TrackEvent[]): Observable<TrackPublication>; | ||
export declare function participantTracksObservable(participant: Participant, trackIdentifier: ParticipantTrackIdentifier): Observable<TrackReference[]>; | ||
export declare function trackEventSelector<T extends TrackEvent>(publication: TrackPublication | Track, event: T): Observable<Parameters<PublicationEventCallbacks[Extract<T, keyof PublicationEventCallbacks>]>>; | ||
export declare function trackTranscriptionObserver(publication: TrackPublication): Observable<[transcription: import("livekit-client").TranscriptionSegment[]]>; | ||
export declare function trackSyncTimeObserver(track: Track): Observable<number>; | ||
export {}; | ||
//# sourceMappingURL=track.d.ts.map |
{ | ||
"name": "@livekit/components-core", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "author": "LiveKit", |
@@ -10,1 +10,2 @@ export * from './detectMobileBrowser'; | ||
export { supportsScreenSharing } from './featureDetection'; | ||
export * from './transcriptions'; |
@@ -17,2 +17,3 @@ import type { | ||
import { observeParticipantEvents } from './participant'; | ||
import type { PublicationEventCallbacks } from 'livekit-client/dist/src/room/track/TrackPublication'; | ||
@@ -174,1 +175,36 @@ export function trackObservable(track: TrackPublication) { | ||
} | ||
export function trackEventSelector<T extends TrackEvent>( | ||
publication: TrackPublication | Track, | ||
event: T, | ||
) { | ||
const observable = new Observable< | ||
Parameters<PublicationEventCallbacks[Extract<T, keyof PublicationEventCallbacks>]> | ||
>((subscribe) => { | ||
const update = ( | ||
...params: Parameters<PublicationEventCallbacks[Extract<T, keyof PublicationEventCallbacks>]> | ||
) => { | ||
subscribe.next(params); | ||
}; | ||
// @ts-expect-error not a perfect overlap between TrackEvent and keyof TrackEventCallbacks | ||
publication.on(event, update); | ||
const unsubscribe = () => { | ||
// @ts-expect-error not a perfect overlap between TrackEvent and keyof TrackEventCallbacks | ||
publication.off(event, update); | ||
}; | ||
return unsubscribe; | ||
}); | ||
return observable; | ||
} | ||
export function trackTranscriptionObserver(publication: TrackPublication) { | ||
return trackEventSelector(publication, TrackEvent.TranscriptionReceived); | ||
} | ||
export function trackSyncTimeObserver(track: Track) { | ||
return trackEventSelector(track, TrackEvent.TimeSyncUpdate).pipe( | ||
map(([timeUpdate]) => timeUpdate), | ||
); | ||
} |
Sorry, the diff of this file is not supported yet
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
641141
186
8769