Skip to content

Fix playback not working after player enters idle state#13390

Merged
TobiGr merged 1 commit intoTeamNewPipe:devfrom
priomsrb:fix-playback-after-idle
Apr 20, 2026
Merged

Fix playback not working after player enters idle state#13390
TobiGr merged 1 commit intoTeamNewPipe:devfrom
priomsrb:fix-playback-after-idle

Conversation

@priomsrb
Copy link
Copy Markdown
Contributor

@priomsrb priomsrb commented Apr 1, 2026

What is it?

  • Bugfix (user facing)

Description of the changes in your PR

  • On some phones the video player enters the STATE_IDLE 10 minutes after being paused. After that the play button on video popups stop working.
  • This bug only happens on certain phones (e.g. Oppo and Oneplus). Doesn't happen on Pixel phones.
  • This happens because once a player has become idle, we need to call prepare() before playback can happen again.

How I implemented the changes:

  • I first tried doing this when the player was idle:
if (isStopped()) {
    simpleExoPlayer.prepare();
    simpleExoPlayer.setPlayWhenReady(true);
}
  • But this caused the video to become black and not actually play.
  • Then I decided to execute the same code that happens when ERROR_CODE_UNSPECIFIED occurs. This causes playback to resume normally.

How to reproduce

If you have a Oneplus or Oppo phone then:

  • Open a video using a popup
  • Pause the video
  • Turn off the screen and wait 10 minutes
  • After ten minutes, try resuming the video
  • Resuming fails

If your phone is different, you can simulate this by adding the following code to Player.java:

    public void setPlaybackSpeed(final float speed) {
        setPlaybackParameters(speed, getPlaybackPitch(), getPlaybackSkipSilence());
        
        // TEMPORARY: Put the player into STATE_IDLE if speed is set to 1.5x
        if (speed == 1.5f) {
            simpleExoPlayer.stop();
        }
    }
  • After that, you can launch a popup video
  • Pause the video
  • Set the speed to 1.5x to make the player enter STATE_IDLE
  • Try resuming the video. Resuming will fail.

Before/After Screenshots/Screen Record

  • Before:
    In the video below, I paused the video, then turned my screen off for 10 minutes. After that, pressing the play button does nothing.
playback_fail_after_idle.mp4
  • After:
    After my code changes, I did the same steps as before, but now the play button worked as expected.

Fixes the following issue(s)

  • I wasn't able to find an existing issue for this. But this problem has existed since I switched from Pixel phones to Oppo and Oneplus a few months ago.
  • Fixes Pausing video freezes stream #13411

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

  • I read the contribution guidelines.
  • The proposed changes follow the AI policy.
    • I first tried making the fix myself. Then I got assistance using Claude Code. I reviewed the change myself and it seemed to make sense.
  • I tested the changes using an emulator or a physical device.
    • I tested my change on my physical device

@github-actions github-actions Bot added the size/small PRs with less than 50 changed lines label Apr 1, 2026
@TobiGr TobiGr added bug Issue is related to a bug player Issues related to any player (main, popup and background) device/software specific Issues that only happen on some devices or with some specific hardware/software labels Apr 1, 2026
@nagi-desuuu nagi-desuuu mentioned this pull request Apr 15, 2026
7 tasks
On some phones (e.g. Oppo and Oneplus) the video player enters the STATE_IDLE 10 minutes after being paused. This causes the play button to stop working.

This happens because once a player has become idle, we need to call prepare() before playback can happen again.

But after I added prepare(), it would just skip to the end of the video. So now I'm executing the same code that happens when ERROR_CODE_UNSPECIFIED is done. This causes playback to resume normally.
@TobiGr TobiGr force-pushed the fix-playback-after-idle branch from b3b36ba to a719b89 Compare April 20, 2026 03:48
Copy link
Copy Markdown
Contributor

@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.

thank you

@TobiGr TobiGr enabled auto-merge April 20, 2026 04:08
@TobiGr TobiGr merged commit 936d5d2 into TeamNewPipe:dev Apr 20, 2026
6 checks passed
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 device/software specific Issues that only happen on some devices or with some specific hardware/software player Issues related to any player (main, popup and background) size/small PRs with less than 50 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pausing video freezes stream

2 participants