Display time remaining until video goes live#2501
Display time remaining until video goes live#2501PrestonN merged 11 commits intoFreeTubeApp:developmentfrom
Conversation
Displays time left in seconds, minutes, hours, and days. This depends on how much time is left.
…into upcoming-display-time-left
also simplified the big if block
|
Thanks for opening a pr! Would you be able to lint it using |
src/renderer/views/Watch/Watch.js
Outdated
| if (upcomingTimeLeft > 60) { | ||
| upcomingTimeLeft = upcomingTimeLeft / 60 | ||
| timeUnit = 'Minute' | ||
| if (upcomingTimeLeft > 120) { |
There was a problem hiding this comment.
Haven't tested yey, but shouldn't this be 60 instead of 120? (Correct me if I'm wrong)
There was a problem hiding this comment.
AFAIK youtube switches to showing time left in minutes at 120 minutes remaining. I tried to replicate how they choose to display it.
Better temp variable scoping, flatten nested code, rename temp variables, use string intepolation Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
Head branch was pushed to by a user without write access
tabs where used in some places in the suggested code
Head branch was pushed to by a user without write access
Since upcomingTimeStamp will be null when the time has passed the scheduled timestamp it doesn't make sense to use something that will rarely be displayed. e.g. a user has to click on the video with less than a second remaing until it goes live for it to be displayed it would also be displayed as "Premieres in Starting soon" which doesn't make sense
Head branch was pushed to by a user without write access
Yes |
|
Let me know when final changes made will put review comment (should pass is no new issue found) |
Looks better and works for values less than 0
Head branch was pushed to by a user without write access
|
I've made the final changes now. |
PikachuEXE
left a comment
There was a problem hiding this comment.
Code looks good, testing locally later
|
I can't find any video on https://www.youtube.com/channel/UC4R8DWoMoI7CAwX8_LjQHig |
You have to open the link on YouTube, it's a special page (so it doesn't work in FreeTube) that shows videos that are currently live and ones that have recently been live. |
PikachuEXE
left a comment
There was a problem hiding this comment.
Tested with a few about to live videos in https://www.youtube.com/channel/UC4R8DWoMoI7CAwX8_LjQHig

Display time remaining until video goes live
Important note
We may remove your pull request if you do not use this provided PR template correctly.
Pull Request Type
Please select what type of pull request this is:
Related issue
closes #2391
alleviates the timezone issue on flatpak #1429
Description
Display how much time is left until the live stream or video premiere goes live above the exact premiere datetime.
This is static and will not update automatically as the premiere time gets closer.
The time left will be displayed in the format "Premieres in X U" where X is a number and U is a time unit such as hours, minutes, or days. I use
Math.floor()on the number so it's always a whole number. From what I have seen this is what YouTube seems to do.When to switch from hours to minutes to seconds remaining is based on how I understand YouTube does it.
Screenshots (if appropriate)
Before:

After:

with custom date





Testing (for code that is not small enough to be easily understandable)
Has this pull request been tested?
Please describe shortly how you tested it and whether there are any ramifications remaining.
I used upcoming livestreams from YouTube live channel and compared the times.
I also tested with a custom date instead of
upcomingTimestampto see if all types of time remaining where displayed correctly.Desktop (please complete the following information):
Additional context
Is it possible to differentiate between live streams and premieres?
If so, then it might be good to have separate strings for them. Such as "Live in" and "Premieres In"
Sometimes YouTube seems to display time remaining like this.

This seems to happen when there is less than 60 minutes left.
I don't know if they do this on all videos now, but that format should only be considered if we update the time automatically
Since I am new to FreeTube development I would appreciate help and feedback.