You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Since version 1.1.0 chewie supports subtitles. Here you can see how to use them.
132
+
> Since version 1.1.0, Chewie supports subtitles.
133
133
134
-
You can provide an`List<Subtitle>` and customize your subtitles with the `subtitleBuilder` function.
134
+
Chewie allows you to enhance the video playback experience with text overlays. You can add a`List<Subtitle>`to your `ChewieController`and fully customize their appearance using the `subtitleBuilder` function.
135
135
136
-
Add subtitles to your `ChewieController` like the following example:
136
+
### Showing Subtitles by Default
137
+
138
+
Chewie provides the `showSubtitles` flag, allowing you to control whether subtitles are displayed automatically when the video starts. By default, this flag is set to `false`.
139
+
140
+
### Adding Subtitles
141
+
142
+
Here’s an example of how to add subtitles to your `ChewieController`:
The `index` attribute is for if you want to structure your subtitles in your database and provide your indexes here. `end` and `text` are the key attributes.
174
+
### Subtitle Structure
175
+
176
+
The `Subtitle` model contains the following key attributes:
168
177
169
-
The Duration defines which part of your video your subtitles should start and end. For example, if your video is 10 minutes long and you want to add a subtitle between: `00:00` and `00:10`'th of a second:
178
+
-**`index`**: A unique identifier for the subtitle, useful for database integration.
179
+
-**`start`**: The starting point of the subtitle, defined as a `Duration`.
180
+
-**`end`**: The ending point of the subtitle, defined as a `Duration`.
181
+
-**`text`**: The subtitle text that will be displayed.
182
+
183
+
For example, if your video is 10 minutes long and you want to add a subtitle that appears between `00:00` and `00:10`, you can define it like this:
170
184
171
185
```dart
172
186
Subtitle(
@@ -177,6 +191,10 @@ Subtitle(
177
191
),
178
192
```
179
193
194
+
### Customizing Subtitles
195
+
196
+
Use the `subtitleBuilder` function to customize how subtitles are rendered, allowing you to modify text styles, add padding, or apply other customizations to your subtitles.
197
+
180
198
## Example
181
199
182
200
Please run the app in the [`example/`](https://github.com/brianegan/chewie/tree/master/example) folder to start playing!
0 commit comments