Introducing NewPlayer
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
https://github.com/user-attachments/assets/6e128b5b-184b-429c-baf6-886eab153854
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
NewPlayerNewPlayerorNewPlay - [x] 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
- [x] 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.
- [x] 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
NewPlayerclass 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.
- [x] 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 newitem. This can be used in combination withCachingRepoto ensure that the caches are eagerly filled upon loading a newitem.
- [x] 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
NewPlayerobject, which again lives in theApplicationinstance. 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.
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!
https://github.com/thesauri/dpad-compose
That's 2 years old. Haven't there been any improvements to JC since then?
@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?
@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
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
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
@toliuweijing yes, we have a chat room, see https://github.com/TeamNewPipe/NewPipe/blob/dev/.github/CONTRIBUTING.md#communication
nice
Sounds very interesting but doesn't work on Android 7. The app tries to start but crashes.
Hei @toliuweijing, I wrote a bugreport over at the NewPlayer repo: https://github.com/TeamNewPipe/NewPlayer/issues/3
Maybe you can already have a look at it. There are three levels you can go:
- Try to reproduce the bug that I describe
- Find the code that causes that issue
- Fix the issue and send a PR
Would you want to try it out?
What do you think about being able to use newplayer to play local video files?
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.
Ah I see, that makes sense. Hopefully the newpipe devs add that functionality then at some point! 🤞
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.
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
Oh, and by the way we now have seek preview:
https://github.com/user-attachments/assets/26527310-0647-43b6-9f73-3d3d2d97cf6d
Its a crashware for my phone. Nokia 2.3 running android 11