feat: YouTube player respects timestamps startAt#1620
Open
ggichure wants to merge 2 commits intothunder-app:developfrom
Open
feat: YouTube player respects timestamps startAt#1620ggichure wants to merge 2 commits intothunder-app:developfrom
ggichure wants to merge 2 commits intothunder-app:developfrom
Conversation
- Implement timestamp extraction for YouTube video URLs - Automatically set video start time from URL parameters - Support multiple timestamp formats (t=, start=, time notation) - Add custom method to parse timestamps in seconds
micahmo
approved these changes
Dec 3, 2024
Member
micahmo
left a comment
There was a problem hiding this comment.
Hey thanks so much for taking on this issue and fixing it! I just left a few minor comments.
| } | ||
|
|
||
| int _convertTimeComponentsToSeconds(RegExpMatch match) { | ||
| int hours = match.group(1) != null ? int.parse(match.group(1)!.replaceAll('h', '')) : 0; |
Member
There was a problem hiding this comment.
You might be able to use RegEx groups so that one of the matches exactly matches the number without the unit (h, s, etc.).
| int minutes = match.group(2) != null ? int.parse(match.group(2)!.replaceAll('m', '')) : 0; | ||
| int seconds = match.group(3) != null ? int.parse(match.group(3)!.replaceAll('s', '')) : 0; | ||
|
|
||
| return hours * 3600 + minutes * 60 + seconds; |
Member
There was a problem hiding this comment.
You could do this as Duration(hours: hours, minutes: minutes, seconds: seconds).inSeconds to avoid "magic numbers".
| } | ||
|
|
||
| int _convertTimeStringToSeconds(String time) { | ||
| final regex = RegExp(r'(\d+h)?(\d+m)?(\d+s)?'); |
Member
There was a problem hiding this comment.
Can you define this RegEx just once and reuse it?
hjiangsu
reviewed
Dec 6, 2024
| url: "https://pub.dev" | ||
| source: hosted | ||
| version: "0.17.3" | ||
| cupertino_icons: |
Member
There was a problem hiding this comment.
Ideally, all the pubspec.lock changes should be reverted unless there was an explicit update to the packages!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Description
Issue Being Fixed
Issue Number: #1619
Screenshots / Recordings
thunder_yt_player_start_at.mp4
Checklist
semanticLabels where applicable for accessibility?