-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subtitles #188
Subtitles #188
Conversation
@kirill09 is this working for you? :) |
yes |
@kirill09 thank you sooo much for this PR :) whats about the conflicts? could you check them? |
@kirill09 I think these changes from you are very important and give chewie a big plus. I would appreciate it, if you have a second look here into this PR and the merge conflicts, so we can have subtitles in chewie :) |
I fixed the conflicts. I will check everything now. @nstrelow if you got time you can also have a quick look. Maybe I am too fast 😂 |
Ok, tested everything, here are my results:
subtitle: Subtitles([
Subtitle('0\n00:00:00 --> 00:00:10\nHello from Subtitles :)'),
]),
subtitleBuilder: (context, subtitle) {
return Text(subtitle);
}, Honestly this is not really user or developer friendly. It's very easy in Dart to export a simple model for this. Yes, model is existing but factory constructor is horrible ^^ sorry to say that. Also: the parameter: subtitle was existing as a parameter but was not passed into the constructor, so I had to fix that. My recommendation: I'll refactor the Subtitle model to pass user-friendly parameters rather then a string like above. /cc @nstrelow Edit: I would also prefer that subtitles appear inside the Video and not in the chewie container. |
@@ -269,6 +270,8 @@ class ChewieController extends ChangeNotifier { | |||
/// Defines a custom RoutePageBuilder for the fullscreen | |||
final ChewieRoutePageBuilder routePageBuilder; | |||
|
|||
Subtitles subtitle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't mention in the constructor. Already fixed.
lib/src/subtitle_model.dart
Outdated
|
||
static Duration stringToDuration(String value) { | ||
final component = value.split(':'); | ||
return Duration( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added check to also pass: 00:00:00 if milliseconds not needed. Already fixed.
lib/src/subtitle_model.dart
Outdated
} | ||
|
||
class Subtitle { | ||
factory Subtitle(String value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
factory constructor will be refactored so it's more user friendly to use.
lib/src/cupertino_controls.dart
Outdated
@@ -75,6 +79,7 @@ class _CupertinoControlsState extends State<CupertinoControls> { | |||
children: <Widget>[ | |||
_buildTopBar(backgroundColor, iconColor, barHeight, buttonPadding), | |||
_buildHitArea(), | |||
_buildSubtitles(chewieController.subtitle), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't align relatively to the video aspect ratio. Will be fixed.
Is this PR ready to merged? |
Nope, I am working on it 🧑🏻💻 |
Hey guys 👋 Sorry for the delay. I moved many times within Germany and now I can continue my work on this important feature. I already got it working, but it's hidden by the controls and I want to make the subtitles aware of the controls. Be prepared 💪🏼 |
subtitle display