registerCaption method

void registerCaption()

Implementation

void registerCaption() {
  room.registerTextStreamHandler(Constant.liveCaptionAgent, (TextStreamReader reader, String participantIdentity) async {
      final raw = await reader.readAll();
      try {
        final jsonData = jsonDecode(raw);
        final caption = CaptionData.fromJson(jsonData);

        handleCaptionTranscription(caption);
      } catch (e) {
        debugPrint("[ERROR] Failed to parse caption: $e");
      }
    },
  );
}