Skip to content
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

fix: default quality setting should respect video aspect ratio #5797

Merged

Conversation

manish99verma
Copy link
Contributor

@manish99verma manish99verma commented Mar 23, 2024

This fixes the issue #5765 where the default quality settings should respect aspect ratio. Now when we will open the shorts and default quality setting is 720p then it will auto play with 1280p.

Copy link
Member

@Bnyro Bnyro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When autoplay continues and the next video is a short again, the factor will be (16/9)^2 after your changes because you did fullscreenReolution * 16/9 twice.
And when the next video is a normal one and not a short, it still uses the resolution for shorts.

TLDR: Your code shouldn't change the fullscreenOrientation variables, it should only read them in the function where the resolution is set and set it to 16/9 * resolution ditectly instead of modifying the variable.

@manish99verma
Copy link
Contributor Author

Now it will set resolution directly without modifing the default variables and when user will change resoultion for Shorts, let say to 1280 then it will save 720 as a default resoultion for current queue.

@Bnyro
Copy link
Member

Bnyro commented Mar 28, 2024

I think it would be better to do this in setPlayerResolution instead of at 3 different places.

@manish99verma
Copy link
Contributor Author

That would work. But, i think it will create some problem when user will select a custom resolution while playing a video. So we can pass a boolean to setPlayerResolution whether it is choosed by user or it's default.

@Bnyro
Copy link
Member

Bnyro commented Mar 28, 2024

That would work. But, i think it will create some problem when user will select a custom resolution while playing a video. So we can pass a boolean to setPlayerResolution whether it is choosed by user or it's default.

Yes, sounds good 👍

@manish99verma
Copy link
Contributor Author

Now i had moved the same code to setPlayerResolution.

Comment on lines 1500 to 1502
if (isShort) {
newResolution = ceil(newResolution * 9.0 / 16.0).toInt()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this code here should be removed, since we already handle that in setPlayerResolution?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it should not be removed. Because when a user is watching a short in queue and changed resolution to 1280p then all landscape videos will also be played on 1280p which should be played on 720p by respecting the aspect ratio.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like/agree on this change, it's not a good idea to modify the newResolution variable, it should always be in the "same format" (normal horizontal video ratio resolution).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This here makes everything more complicated and I don't think anybody knows what's going on when maintaining that code in the future.

@manish99verma manish99verma requested a review from Bnyro April 1, 2024 04:51
@manish99verma manish99verma requested a review from Bnyro April 3, 2024 03:00
@Bnyro Bnyro force-pushed the fix-default-quality-setting-for-shorts branch from 6f8c9f2 to 7c893cd Compare April 17, 2024 17:24
@Bnyro Bnyro force-pushed the fix-default-quality-setting-for-shorts branch from 7c893cd to 12dd526 Compare April 17, 2024 17:26
@Bnyro Bnyro force-pushed the fix-default-quality-setting-for-shorts branch from 12dd526 to 1f218ff Compare April 17, 2024 17:26
@Bnyro Bnyro merged commit 1ccde40 into libre-tube:master Apr 17, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants