Skip to content

Conversation

@Profpatsch
Copy link
Contributor

@Profpatsch Profpatsch commented Jan 27, 2025

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

First few commits are from #11829 (merge first & rebase)
This partially conflicts with #9592

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

@github-actions github-actions bot added the size/giant PRs with more than 750 changed lines label Jan 27, 2025
@ShareASmile 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
@Isira-Seneviratne
Copy link
Member

Might be a good idea to look into migrating to Media3: https://developer.android.com/media/media3/exoplayer

@Profpatsch
Copy link
Contributor Author

@Isira-Seneviratne that’s exactly what newPlayer does. This is the initial work to integrate NewPlayer into NewPipe

@Profpatsch
Copy link
Contributor Author

i.e. adjust all the interfaces in a way that we can slot in NewPlayer easily into the existing player logic

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Generally looks good to me, thanks! You can probably ignore my comments in PlayerService since it will be quite different after the Android Auto PR anyway.

Copy link
Contributor

@HatakeKakashri HatakeKakashri left a comment

Choose a reason for hiding this comment

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

Just a few minor comments to look into

@Profpatsch Profpatsch force-pushed the player-classes-kotlin-conversion branch from 5a2047f to 31ade7c Compare May 13, 2025 14:04
@Profpatsch Profpatsch requested a review from Stypox May 13, 2025 14:04
@Profpatsch
Copy link
Contributor Author

Profpatsch commented May 13, 2025

Rebased on top of #11829

I removed the “lateinit” commit for PlayerService, because there is no reasonable way to make the player non-nullable now that the Android Auto change has landed.

@Stypox Stypox force-pushed the player-classes-kotlin-conversion branch from 31ade7c to b537be8 Compare May 13, 2025 21:45
@github-actions github-actions bot added size/large PRs with less than 750 changed lines and removed size/giant PRs with more than 750 changed lines labels May 13, 2025
@github-project-automation github-project-automation bot moved this to In Progress in Rewrite May 13, 2025
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

After you fix the artifacts from the conversion to Kotlin feel free to merge this (or ask me for approval). Thanks!

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 the Kotlin code style in this class can be improved, e.g. the Consumers can be replaced with just lambdas I believe, and a lot of !! can be removed or replaced with ? or reworked in general

Copy link
Contributor

Choose a reason for hiding this comment

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

Yupp, Can convert all Consumer and BiConsumer to lambdas

if (Intent.ACTION_MEDIA_BUTTON.equals(intent.getAction())
&& (player == null || player.getPlayQueue() == null)) {
if (Intent.ACTION_MEDIA_BUTTON == intent.action &&
(player == null || player!!.playQueue == null)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
(player == null || player!!.playQueue == null)
(player?.playQueue == null)

Comment on lines 225 to 226
if (onPlayerStartedOrStopped != null) {
// notify that the player is being destroyed
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (onPlayerStartedOrStopped != null) {
// notify that the player is being destroyed
// notify that the player is being destroyed
onPlayerStartedOrStopped?.accept(null)

@Profpatsch Profpatsch force-pushed the player-classes-kotlin-conversion branch from b537be8 to 8d0249b Compare May 14, 2025 16:44
@github-actions github-actions bot added size/giant PRs with more than 750 changed lines and removed size/large PRs with less than 750 changed lines labels May 14, 2025
Copy link
Contributor

@HatakeKakashri HatakeKakashri left a comment

Choose a reason for hiding this comment

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

Only few comments in Kotlin conversion. You can fix those and go ahead with merge.

@ShareASmile ShareASmile added the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Jun 1, 2025
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 a bit unwieldy in places, but should improve the safety of the
code in the face of possible race conditions.
We directly call the `getService` function after receiving the
argument, so resolving the WeakPointer should never return `null` in
our case.
Of course there could be a race condition in theory, but I feel like
if that happens we have bigger problems?
@Profpatsch
Copy link
Contributor Author

@snaik20 btw if you have some nitpicks/trivial improvements, it’s fine if you add a commit and push that directly on the branch; I’m guessing you have the editor open anyway and it prevents a bunch of back-and-forth

@github-actions github-actions bot removed the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Jun 5, 2025
@Profpatsch Profpatsch force-pushed the player-classes-kotlin-conversion branch from 31ca1c5 to 73fef26 Compare June 5, 2025 11:56
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 5, 2025

@Profpatsch Profpatsch merged commit 006b4c9 into TeamNewPipe:refactor Jun 5, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Rewrite Jun 5, 2025
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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants