@livekit/components-core
Advanced tools
Comparing version
{ | ||
"name": "@livekit/components-core", | ||
"version": "0.12.6", | ||
"version": "0.12.7", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "author": "LiveKit", |
@@ -60,2 +60,4 @@ import { RoomEvent, type Room } from 'livekit-client'; | ||
const segmentAttribute = 'lk.segment_id'; | ||
room.registerTextStreamHandler(topic, async (reader, participantInfo) => { | ||
@@ -69,6 +71,14 @@ // Create an observable from the reader | ||
const isTranscription = !!reader.info.attributes?.[segmentAttribute]; | ||
// Subscribe to the stream and update our array when new chunks arrive | ||
streamObservable.subscribe((accumulatedText) => { | ||
// Find and update the stream in our array | ||
const index = textStreams.findIndex((stream) => stream.streamInfo.id === reader.info.id); | ||
const index = textStreams.findIndex( | ||
(stream) => | ||
stream.streamInfo.id === reader.info.id || | ||
(isTranscription && | ||
stream.streamInfo.attributes?.[segmentAttribute] === | ||
reader.info.attributes?.[segmentAttribute]), | ||
); | ||
if (index !== -1) { | ||
@@ -75,0 +85,0 @@ textStreams[index] = { |
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
716647
0.3%9762
0.25%