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

Refactor Player.useVideoSource logic and improve its comments #10195

Conversation

AudricV
Copy link
Member

@AudricV AudricV commented Jun 28, 2023

What is it?

  • Bugfix (user facing)

Description of the changes in your PR

This PR simplifies the logic of the useVideoSource method of the Player class and improves its comments. These changes should resolve the issues of video and text tracks renderers not enabling in some cases.

Detailed version of the changes:

  • don't check for isAudioOnly == !videoEnabled, as this prevents enabling again
    video and text tracks renderers in some cases;
  • when reloading play queue manager if that's needed, disable or enable video
    and text tracks renderers, as they may need to be enabled again in some cases
    like starting a video in main player, opening play queue, switching to
    background player on it and switching back to main player;
  • disable or enable video renderers also for streams with AUDIO_STREAM
    StreamType, as doing so doesn't raise any issue and simplifies code;
  • reword and move some comments to make them easier to understand.

Fixes the following issue(s)

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.

Please test intensively these changes, by switching between multiple player types and streams of different services and testing every combination possible, to ensure that I introduced no regression.

Due diligence

@AudricV AudricV added bug Issue is related to a bug player Issues related to any player (main, popup and background) labels Jun 28, 2023
Copy link
Member

@TobiGr TobiGr left a comment

Choose a reason for hiding this comment

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

The code changes make sense to me, but I have limited knowledge of the player. Somebody else might want to review this PR, too.

app/src/main/java/org/schabi/newpipe/player/Player.java Outdated Show resolved Hide resolved
- don't check for isAudioOnly == !videoEnabled, as this prevents enabling again
video and text tracks renderers in some cases;
- when reloading play queue manager if that's needed, disable or enable video
and text tracks renderers, as they may need to be enabled again in some cases
like starting a video in main player, opening play queue, switching to
background player on it and switching back to main player;
- disable or enable video renderers also for streams with AUDIO_STREAM
StreamType, as doing so doesn't raise any issue and simplifies code;
- reword and move some comments to make them easier to understand.
@AudricV AudricV force-pushed the player_refactor-renderers-activation-or-deactivation branch from 124f847 to 5ab3a4a Compare July 19, 2023 20:52
@sonarcloud
Copy link

sonarcloud bot commented Jul 19, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@TobiGr
Copy link
Member

TobiGr commented Jul 22, 2023

I took a closer look and tested a bit more. I cannot think of anything that could go wrong by merging this.

@TobiGr TobiGr merged commit 3edd4c0 into TeamNewPipe:dev Jul 22, 2023
4 of 5 checks passed
@AudricV AudricV deleted the player_refactor-renderers-activation-or-deactivation branch July 22, 2023 12:43
This was referenced Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug player Issues related to any player (main, popup and background)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants