Skip to content

Major rework to player#2689

Open
Luna712 wants to merge 9 commits intorecloudstream:masterfrom
Luna712:player-rework
Open

Major rework to player#2689
Luna712 wants to merge 9 commits intorecloudstream:masterfrom
Luna712:player-rework

Conversation

@Luna712
Copy link
Copy Markdown
Contributor

@Luna712 Luna712 commented Apr 17, 2026

This practically rebuilds the entire player (sans IPlayer/CS3IPlayer), aimed to remove the FullScreenPlayer inheritance from ResultFragmentPhone, use BaseFragment for ResultFragmentPhone and the player, and make the player easier to maintain and expand in the future, as well overall cleanup to code readability and adding documentation to methods in the player. Also aimed to not fully crash if the layouts have minor differences as well.

Eventually FullScreenPlayer could be entirely factored out into helper methods for GeneratorPlayer, and AbstractPlayerFragment removed completely, but to reduce the chance of harder to resolve merge conflicts with removed files, I decided to not do it in this PR.

Luna712 added 4 commits April 17, 2026 16:26
This practically rebuilds the entire player, aimed to remove the FullScreenPlayer inheritance from ResultFragmentPhone, use BaseFragment for ResultFragmentPhone and the player, and make the player easier to maintain and expand in the future, as well overall cleanup to code readability and adding documentation to methods in the player.
@Luna712
Copy link
Copy Markdown
Contributor Author

Luna712 commented Apr 18, 2026

This is mostly ready for review. Though there may still be a few bugs since I wrote a lot of the code from scratch in many places (some of the code is stuff I worked on ~6 months ago, for about two months but gave up as I ran into some issues I couldn't figure but finally finished it and expanded to all the new features since then now).

If you feel this should be done a different way I could do that also, but this was just designed to make it easier in the future.

@Luna712 Luna712 marked this pull request as ready for review April 18, 2026 20:57
Copy link
Copy Markdown
Collaborator

@fire-light42 fire-light42 left a comment

Choose a reason for hiding this comment

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

I have not looked in-depth at each line yet, given the sheer magnitude of this diff. It is hard to keep track of what is refactored, moved or unchanged. However, I like what I see so far.

Comment thread app/src/main/java/com/lagradost/cloudstream3/ui/player/AbstractPlayerFragment.kt Outdated
Comment thread app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerView.kt Outdated
@Luna712 Luna712 changed the title Major rework to player inheritance to use BaseFragment Major rework to player Apr 20, 2026
Copy link
Copy Markdown
Collaborator

@fire-light42 fire-light42 left a comment

Choose a reason for hiding this comment

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

Very good pull request! I did not find any big glaring issues in the code or when testing.

The only bugs I found was:

  1. player_video_title_rez is not hidden when locked
  2. Brightness and volume sliders are still accessible when locked
  3. player_metadata_scrim is visible on trailers on phone

Please also note that while your formatting is great, it is not standard to android studio, and will cause the next person to touch the file to get +-500. Please format it with android studio or figure out some setting to disallow it on these files.

I have also noticed that you removed a lot of comments, I am fine if you reword it. However, functions like verifyVolume lose context of why it is done, similar for currentZoomMatrix, and for the comments in createScaleGestureDetector. You should never remove a "why" comment, as it makes it harder to read the code later and understand the decision, intent, and why something else is not done.

To be clear, doc comments that explain the "what" is done, e.g. functionally is entirely free to update, as they do not contain any inherit information that can not be gleaned from the code.

While the clean code book is not perfect, and has a lot of misguided advice, the comments sections is worth reading: https://bitsyncvortex.github.io/Books/pdfs/ComputerScience/CleanCode.pdf page 55+

Comment thread app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerGestureHelper.kt Outdated
Comment thread app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerGestureHelper.kt Outdated
@Luna712
Copy link
Copy Markdown
Contributor Author

Luna712 commented Apr 21, 2026

Thank you for the review! I will try and finish this up tomorrow.

@Luna712
Copy link
Copy Markdown
Contributor Author

Luna712 commented Apr 21, 2026

Is "player_video_title_rez is not hidden when locked" an issue on pre as well? I don't see where it hides on pre either. I can fix it here though anyway and may be just missing it.

Also not sure what you mean by "Please also note that while your formatting is great, it is not standard to android studio, and will cause the next person to touch the file to get +-500. Please format it with android studio or figure out some setting to disallow it on these files."

Because I wrote it within Android Studio in the first place and it does not try to reformat or anything.

@Luna712
Copy link
Copy Markdown
Contributor Author

Luna712 commented Apr 21, 2026

The 3 bugs mentioned should be fixed now. Comments restored as well. Still not sure what was meant by formatting though.

Also, another side effect of this now is trailer_custom_layout should be able to be its own thing. It will no longer cause inflation errors if deviating from the other player layouts and the other player layouts no longer need anything only used in trailer either. I could do a follow-up PR to clean this up if wanted unless you want to still keep it exactly in sync even though no longer needed?

@Luna712 Luna712 requested a review from fire-light42 April 21, 2026 20:00
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.

2 participants