Closed SeongWoo-97 closed 1 year ago
Hello, I have a problem with my video player. The video works fine, but the captions are not displaying. I've checked the documentation, but it's hard to find any information about captions. Here is a part of the code I've written: ` _init() async { final result = await FilePicker.platform.pickFiles( type: FileType.custom, allowedExtensions: ['mp4', 'srt'], allowMultiple: true, );
if (result != null) { File? videoFile; File? srtFile; for (var file in result.files) { if (file.extension == 'mp4') { videoFile = File(file.path!); } else if (file.extension == 'srt') { srtFile = File(file.path!); } } if (videoFile != null) { Future<ClosedCaptionFile>? subRipCaptionFileFuture; if (srtFile != null) { subRipCaptionFileFuture = _loadSubRipCaptionFile(srtFile); } _meeduPlayerController.setDataSource( DataSource( type: DataSourceType.file, file: videoFile, closedCaptionFile: subRipCaptionFileFuture, ), autoplay: true, ); } }
}
Future
_loadSubRipCaptionFile(File srtFile) async { final srtContent = await srtFile.readAsString(); return SubRipCaptionFile(srtContent); } ` I would appreciate any help or guidance on how to display captions in the video player. Thanks in advance!
That's on the desktop? I didn't really implement it there,but I will try to check on it and let you know.
Can you provide the caption file?
@SeongWoo-97 did you check this??https://github.com/zezo357/flutter_meedu_videoplayer/blob/master/package/example/lib/pages/network_with_subtitle_page.dart
you have to call _controller.onClosedCaptionEnabled(true);
to show captions
Hello, I have a problem with my video player. The video works fine, but the captions are not displaying. I've checked the documentation, but it's hard to find any information about captions. Here is a part of the code I've written: ` _init() async { final result = await FilePicker.platform.pickFiles( type: FileType.custom, allowedExtensions: ['mp4', 'srt'], allowMultiple: true, );
}
Future _loadSubRipCaptionFile(File srtFile) async {
final srtContent = await srtFile.readAsString();
return SubRipCaptionFile(srtContent);
}
`
I would appreciate any help or guidance on how to display captions in the video player. Thanks in advance!