From 64eb7863c309ca718d02ae4a3201f167a11c21b7 Mon Sep 17 00:00:00 2001 From: Zita Szupera Date: Fri, 4 Oct 2024 10:23:11 -0500 Subject: [PATCH] Add start/stop endpoints --- .../docs/javascript/02-guides/16-closed-captions.mdx | 9 ++++++++- sample-apps/client/ts-quickstart/src/closed-captions.ts | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/client/docusaurus/docs/javascript/02-guides/16-closed-captions.mdx b/packages/client/docusaurus/docs/javascript/02-guides/16-closed-captions.mdx index 38c8f58d3a..bb5897fdd9 100644 --- a/packages/client/docusaurus/docs/javascript/02-guides/16-closed-captions.mdx +++ b/packages/client/docusaurus/docs/javascript/02-guides/16-closed-captions.mdx @@ -37,7 +37,14 @@ console.log(call.state.settings?.transcription.closed_caption_mode); ## Enabling and disabling closed caption events -TODO +If you set `closed_caption_mode` to `available` you need to enable closed caption events when you want to see captions: + +```typescript +await this.call.startClosedCaptions(); + +// to disable them +await this.call.stopClosedCaptions(); +``` ## Displaying the captions diff --git a/sample-apps/client/ts-quickstart/src/closed-captions.ts b/sample-apps/client/ts-quickstart/src/closed-captions.ts index bbd59623f1..902534e3b1 100644 --- a/sample-apps/client/ts-quickstart/src/closed-captions.ts +++ b/sample-apps/client/ts-quickstart/src/closed-captions.ts @@ -35,15 +35,17 @@ export class ClosedCaptionManager { return this.captionContainer; } - showCaptions() { + async showCaptions() { this.status = 'on'; + await this.call.startClosedCaptions(); this.unsubscribe = this.call.state.closedCaptions$.subscribe((captions) => { this.updateDisplayedCaptions(captions); }).unsubscribe; } - hideCaptions() { + async hideCaptions() { this.status = 'off'; + await this.call.stopClosedCaptions(); this.cleanup(); }