Skip to content

Commit

Permalink
Add start/stop endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
szuperaz committed Oct 4, 2024
1 parent aa56be1 commit 64eb786
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions sample-apps/client/ts-quickstart/src/closed-captions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 64eb786

Please sign in to comment.