subtitle_wrapper 0.1.1
A Subtitle Wrapper package, this subtitle wrapper package displays subtitles for implemented players.
Subtitles Wrapper
The Subtitle Wrapper package provides an easy way to display subtitles for videos using the VLC player in a Flutter application. It supports multiple subtitle formats and allows for dynamic subtitle delay adjustments.
Features
- Display subtitles from SRT and WebVTT files.
- Adjust subtitle delay dynamically.
- Customize subtitle text style.
Getting Started
Installation
Add the following dependency to your pubspec.yaml:
Usage
-
Initialize the Subtitle Controller:
Create an instance of
SubtitleControllerwith the desired subtitle URL and type.SubtitleController subtitleController = SubtitleController( subtitleUrl: 'https://example.com/subtitles.srt', subtitleType: SubtitleType.srt, subtitleDecoder: SubtitleDecoder.utf8, ); -
Set up the VLC Player:
Initialize the
VlcPlayerControllerwith the video URL.VlcPlayerController vlcPlayerController = VlcPlayerController.network( 'http://example.com/video.mp4', autoPlay: true, ); -
Use the Subtitles Wrapper:
Wrap your VLC player with the
SubtitleWrapperwidget to display subtitles.startLine: 7 endLine: 48 -
Adjust Subtitles Delay:
Use the
addSubtitleDelayandremoveSubtitleDelaymethods to adjust the subtitle delay in milliseconds.startLine: 72 endLine: 86
Example
Here's a simple example of how to integrate the subtitle wrapper in your Flutter app:
References
-
For more details on the
SubtitleControllerand its methods, refer to the code snippet: lib/subtitle_controller.dart -
For the complete example setup, see: example/lib/main.dart