-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
Some simple refactors & beginning of kotlin conversions of the player classes #11965
Open
Profpatsch
wants to merge
12
commits into
TeamNewPipe:refactor
Choose a base branch
from
Profpatsch:player-classes-kotlin-conversion
base: refactor
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Some simple refactors & beginning of kotlin conversions of the player classes #11965
Profpatsch
wants to merge
12
commits into
TeamNewPipe:refactor
from
Profpatsch:player-classes-kotlin-conversion
Conversation
This file contains 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
And simplify the code a little
In Kotlin, dealing with nulls works better so we don’t need optional.
The new implementation would throw `ConcurrentModificationExceptions` when destroying the UIs. So let’s play it safe and put the list behind a mutex. Adds a helper class `GuardedByMutex` that can be wrapped around a property to force all use-sites to acquire the lock before doing anything with the data.
No adjustments done yet; only change is that I added an upper bound on `PlayerUi` to the `PlayerUiList` functions, so “everything” is now `null` in `destroyAll`.
This removes a bunch of unncessary checks. We forgo setting player to `null` in onDestroy, because shutting it down and when the service stops should be enough to free it for garbage collection.
Because the class is final, protected does not make sense (Android Studio auto-suggestions)
The `R.id` link from the comment cannot be resolved, so let’s not link it for now. We are using some exoplayer2 resources, let’s silence the warning.
It’s only used in this one place.
ShareASmile
added
codequality
Improvements to the codebase to improve the code quality
rewrite
Issues and PRs related to rewrite
player
Issues related to any player (main, popup and background)
labels
Jan 27, 2025
Might be a good idea to look into migrating to Media3: https://developer.android.com/media/media3/exoplayer |
@Isira-Seneviratne that’s exactly what newPlayer does. This is the initial work to integrate NewPlayer into NewPipe |
i.e. adjust all the interfaces in a way that we can slot in NewPlayer easily into the existing player logic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
codequality
Improvements to the codebase to improve the code quality
player
Issues related to any player (main, popup and background)
rewrite
Issues and PRs related to rewrite
size/giant
PRs with more than 750 changed lines
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.
First few commits are from #11829 (merge first & rebase)
This partially conflicts with #9592
What is it?
Description of the changes in your PR
Before/After Screenshots/Screen Record
Fixes the following issue(s)
Relies on the following changes
APK testing
The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.
Due diligence