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

Introducing NewPlayer #11603

Open
5 of 20 tasks
theScrabi opened this issue Oct 8, 2024 · 17 comments
Open
5 of 20 tasks

Introducing NewPlayer #11603

theScrabi opened this issue Oct 8, 2024 · 17 comments
Labels
feature request Issue is related to a feature in the app player Issues related to any player (main, popup and background) rewrite Issues and PRs related to rewrite

Comments

@theScrabi
Copy link
Member

theScrabi commented Oct 8, 2024

Dear NewPipers,

I give to you the fruit of my labor for the last three months that I worked for the NewPipe Association: NewPipe's (hopefully) next player: NewPlayer.

But let's start from the beginning. NewPipe's current player implementation isn't very good. Its code is ugly, and it is based on the outdated ExoPlayer 2. So because of the ongoing refactoring process, I decided to rewrite the player and tackle the pain points we currently have with it.

NewPlayer

NewPipe's next media player framework



Icon by Jaime López

So what is NewPlayer then?

NewPlayer is a media framework independent of NewPipe itself. I decided to make it independent, because one of the big issues we have with the current player is that it is deeply integrated into NewPipe. Therefore, I wanted to make NewPlayer a separate module in order to enforce that the interface between NewPipe and the player is only as big as necessary. This also has the advantage that NewPlayer can be used independently of NewPipe itself, which means it can be used in other apps too.

Let me give you a Profile about NewPlayer:

  • It is a module, separate from NewPipe and can be used as an independent player framework
  • It is based on the Media3 library
  • Its UI is created with Jetpack Compose
  • It's fully written in Kotlin
  • Its UI resembles the UI of the current NewPipe player, but improves it
  • The UI uses Material You theming
  • It follows an MVVM architecture
  • It is GPLv3 licensed

How does NewPlayer look like?


Embedded Screen in test App

Fullscreen

Audio frontend

Audio frontend landscape

Playlist screen

Chapter screen

Picture in Picture

Volume indicator

Main menu

Here a video showing NewPlayer

screen-20241008-174248_EDIT.mov

Try It your self

Download NewPlayer testapp from NewPipe e.V.

Here you can find the code of NewPlayer

Things that still need to be done

Well. NewPlayer is not yet finished. It still has many quirks and there are pieces that are straight up missing. However, I want to start to slowly hand over the development, as I will start a 9 to 5 job at the end of this month. So after this month I will only be able to give advice or feedback, but I will not really be able to actively develop anymore.

Here is a list of things that are still missing or are not correctly working yet. If you want to help, please note I have sorted the list by importance. I will work on the most important things by myself. So if you want to help, you might not want to pick the very first item, in order for us not collide with our development efforts.

Things that still need to be done

  • Stream and Track selection
  • Decide weather to call NewPlayer NewPlayer or NewPlay
  • Documentation
    Documentation is critical. I will do most of it myself before I leave for my new job. This way you can better understand how to use NewPlayer or what my intentions were.
  • UI for Speed and Pitch selection
  • Content ratio not correct in embedded view
    Sometimes the video is not correctly fitted within the embedded view. The video itself is stretched while black bars are visible on the top and the bottom. The black bars should not be there, and the video should not be stretched vertically.
  • Fix Content fit mode
    Changing the content fit mode is not working correctly, and the menu item does nothing atm.
  • Default brightness can not be restored when leaving fullscreen mode
  • Original rotation is not always restored correctly when leaving fullscreen mode
  • Playback mode changes made from outside NewPlayer can introduce faulty playback states
  • System bar color can not be restored when leaving fullscreen mode
  • Subtitle selection
    Subtitle selection and subtitle settings is completely missing atm.
  • Proper layout
    The layout of many UI elements in NewPlayer are only roughly placed. My GF is a multimedia designer. She didn't like the UI, but offered to help place the elements better.
  • Proper theming (required by Audio player UI)
    The theme atm is only sort of a placeholder. It is not final and should therefore be adjusted to match the colors for NewPipe. Even more there should be a way to customize the theme without having to recompile the whole player. This could be achieved by making the theme be a parameter of the NewPlayer class constructor.
    Furthermore, NewPlayer currently has no Light theme. This was important for the audio UI.
  • Testing
    There are no tests for NewPlayer. I simply did not have the time yet. However, it would be good to have some UI and unit tests. Additionally, there should be fuzzy tests, because simply tapping randomly on the UI still sometimes breaks the player.
  • Auxiliary repositories
    I imagined 3 auxiliary repository implementations that can be used in combination with an actual repository.
    These are:
    • MultiRepo: Helps to combine multiple Repositories into one repo. This way each actual repo can focus on serving one backend.
    • CachingRepo: A repository that helps as an in memory cache. This is necessary since NewPlayer does not provide a cache itself and basically requests the same Data over and over again if it needs it. (@TeamNewPipe/appdev: Don't use this! NewPipe has its own cache. It would be better if NewPipe used its already existing cache, so data can be shared between NewPipe and NewPlayer)
    • PrefetchRepo: A repo that requests all possible requests it can make once it sees a new item. This can be used in combination with CachingRepo to ensure that the caches are eagerly filled upon loading a new item.
  • Animations are sometimes missing or are stuttery or clunky
  • Integration with NewPipe
  • DPad Support
    The current player of NewPipe is not usable with only a DPad and an Enter key. This makes NewPipe unusable on a TV. Now that we rewrite the player we could try to put more attention at this. The issue now is that Jatpack Compose does not seem to be very good at supporting DPad input: see here
  • TV Mode
    TV Mode is a special mode for NewPlayer, intended for Android TV devices. You see, by default Media3 devs suggest putting the ExoPlayer into a MediaSession Service. However, NewPlayer puts the ExoPlayer instance into its NewPlayer object, which again lives in the Application instance. Therefore, NewPlayer can be used without a MediaSession and its respective foreground Service. This would be beneficial for Android TV devices, as these often don't support Notifications. This then means, if I close NewPipe on, let's say, a FireTV Stick, it would continue to playback in background. However, you won't be able to control the playback unless you open the App again. The actual expected behavior should be that playback stops, which would work if the MediaSession was disabled. The TV Mode, and the DPad support would be necessary for NewPlayer to support Android TV.
  • Clipped text does not scroll
    Some text, like titles or chapter descriptions are too large to fit in the screen. NewPipe currently scrolls through such text, so the user is able to read the entire text. NewPlayer ellipses the text atm. It was nice however if the text was scrolling again.
@ShareASmile ShareASmile added feature request Issue is related to a feature in the app player Issues related to any player (main, popup and background) rewrite Issues and PRs related to rewrite labels Oct 9, 2024
@opusforlife2
Copy link
Collaborator

Decide weather to call NewPlayer NewPlayer or NewPlay

Sorted by importance, indeed. xD

I'm so, so happy to see first class support for audio playback in the foreground!

@opusforlife2
Copy link
Collaborator

https://github.com/thesauri/dpad-compose

That's 2 years old. Haven't there been any improvements to JC since then?

@opusforlife2
Copy link
Collaborator

@snaik20 @uragiristereo @imashnake0 @lm41 @YongJunLim @AaronRietschlin @sandy-8925 @PrimoDev23 @EricDriussi @rahul-gill @Profpatsch @Chinaqth @acrodemocide @fuzzblob @XilinJia @GGindin @davidasunmo @chriss2401 @toliuweijing @Two-Ai

Hey guys. Here's another major pillar of the rewrite effort that desperately needs more hands on deck. Are any of you interested and able to contribute here?

@acrodemocide
Copy link

@opusforlife2 Yes, I'm interested in contributing. I've mostly reviewed pull requests and have tested the builds on my Android device as part of the review to let report back whether it's working or not.

If I have the time, I'll look into picking up some issues to make code changes for, but in the last update, the request was mostly for support in code reviews and testing, and I'm happy to keep doing that in my free time. I love NewPipe and want to see it continue to be successful

@toliuweijing
Copy link

toliuweijing commented Oct 10, 2024

Yes. Should be able to pick up items after understanding the NewPlayer codebase.

I'm new to open source contribution. Sometime I need support / discussion to unblock myself. Is there a preferable way to discuss the refactoring work? e.g. a dedicated chat room for people active on the refactoring work should be perfect. cc @theScrabi @opusforlife2 WDYT

@nirodhvana
Copy link

Cant we just design the extra player options(subtitles,etc) like it is right now instead of a triple dot menu

it is much easier to navigate them

@Stypox
Copy link
Member

Stypox commented Oct 11, 2024

@gigigigi53

This comment was marked as spam.

@zeropi2021

This comment was marked as off-topic.

@theScrabi
Copy link
Member Author

Hei @toliuweijing, I wrote a bugreport over at the NewPlayer repo: TeamNewPipe/NewPlayer#3

Maybe you can already have a look at it. There are three levels you can go:

  1. Try to reproduce the bug that I describe
  2. Find the code that causes that issue
  3. Fix the issue and send a PR

Would you want to try it out?

@jm355
Copy link

jm355 commented Oct 26, 2024

What do you think about being able to use newplayer to play local video files?

@theScrabi
Copy link
Member Author

Sure, but someone else would have to make NewPlayer do that.
NewPlayer is written like a framework. So anyone can feel free to write an app around NewPlayer to make it able to play back local files.

@jm355
Copy link

jm355 commented Oct 27, 2024

Ah I see, that makes sense. Hopefully the newpipe devs add that functionality then at some point! 🤞

@ccateni
Copy link

ccateni commented Oct 29, 2024

Sure, but someone else would have to make NewPlayer do that. NewPlayer is written like a framework. So anyone can feel free to write an app around NewPlayer to make it able to play back local files.

Honestly, I would kill for an app that plays local files with the speed, pitch and skip silence controls of newpipe.

@theScrabi
Copy link
Member Author

theScrabi commented Oct 29, 2024

I put online parts of NewPlayer's documentation yesterday. Checkout: https://github.com/TeamNewPipe/NewPlayer
With this you should be able to experiment with NewPlayer for a bit :)

Code review, feedback, or changes are always welcome. The more help I can get the faster we can make NewPlayer be a part of NewPipe. :D

@theScrabi
Copy link
Member Author

Oh, and by the way we now have seek preview:

screen-20241029-200258_EDIT.mov

@clemencyworld1
Copy link

Its a crashware for my phone. Nokia 2.3 running android 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issue is related to a feature in the app player Issues related to any player (main, popup and background) rewrite Issues and PRs related to rewrite
Projects
None yet
Development

No branches or pull requests