Skip to content

Commit 6901fda

Browse files
committed
docs: update example, add screenshot
1 parent 067c47e commit 6901fda

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

packages/react-native-sdk/docusaurus/docs/reactnative/05-ui-cookbook/21-closed-captions.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ description: How to add closed captions to your calls
77
The Stream API supports adding real-time closed captions (subtitles for participants) to your calls.
88
This guide shows you how you can build it on top of our React Native SDK.
99

10+
![Preview of the Closed Captions component](../assets/05-ui-cookbook/21-closed-captions/cc-preview.png)
11+
1012
## Prerequisites
1113

1214
Make sure that the closed caption feature is enabled in your app's dashboard.
@@ -64,15 +66,19 @@ Once enabled, the SDK will expose the closed caption events to your application
6466
This is how it can be used:
6567

6668
```tsx
69+
import { StyleSheet, Text, View } from 'react-native';
6770
import { useCallStateHooks } from '@stream-io/video-react-native-sdk';
6871

6972
export const ClosedCaptions = () => {
7073
const { useCallClosedCaptions } = useCallStateHooks();
7174
const closedCaptions = useCallClosedCaptions();
7275
return (
7376
<View style={styles.rootContainer}>
74-
{closedCaptions.map(({ speaker_name, text }) => (
75-
<View style={styles.closedCaptionItem} key={`${speaker_name}/${text}`}>
77+
{closedCaptions.map(({ speaker_name, start_time, text }) => (
78+
<View
79+
style={styles.closedCaptionItem}
80+
key={`${speaker_name}/${start_time}`}
81+
>
7682
<Text style={styles.speakerName}>{speaker_name}:</Text>
7783
<Text style={styles.closedCaption}>{text}</Text>
7884
</View>
533 KB
Loading

sample-apps/react-native/dogfood/src/components/ClosedCaptions.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ export const ClosedCaptions = () => {
88
const closedCaptions = useCallClosedCaptions();
99
return (
1010
<View style={styles.rootContainer}>
11-
{closedCaptions.map(({ speaker_name, text }) => (
12-
<View style={styles.closedCaptionItem} key={`${speaker_name}/${text}`}>
11+
{closedCaptions.map(({ speaker_name, start_time, text }) => (
12+
<View
13+
style={styles.closedCaptionItem}
14+
key={`${speaker_name}/${start_time}`}
15+
>
1316
<Text style={styles.speakerName}>{speaker_name}:</Text>
1417
<Text style={styles.closedCaption}>{text}</Text>
1518
</View>

0 commit comments

Comments
 (0)