Skip to content

feature: Persisted the repeat mode flag using shared preferences#13387

Open
arjun1194 wants to merge 3 commits intoTeamNewPipe:devfrom
arjun1194:repeat-mode-persist
Open

feature: Persisted the repeat mode flag using shared preferences#13387
arjun1194 wants to merge 3 commits intoTeamNewPipe:devfrom
arjun1194:repeat-mode-persist

Conversation

@arjun1194
Copy link
Copy Markdown
Contributor

@arjun1194 arjun1194 commented Mar 30, 2026

What is it?

  • Bugfix (user facing)
  • Feature (user facing) ⚠️ Your PR must target the refactor branch
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • Persisted the repeat mode flag into shared preferences and when initializing the player, reading that flag from shared preferences.

Before/After Screenshots/Screen Record

  • Before:
myvideo_2.mp4
  • After:
myvideo.mp4

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. You can find more info and a video demonstration on this wiki page.

Due diligence

@github-actions github-actions bot added the size/small PRs with less than 50 changed lines label Mar 30, 2026
Copy link
Copy Markdown
Member

@absurdlylongusername absurdlylongusername left a comment

Choose a reason for hiding this comment

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

Saying this now to save time saying it later: the code as it stands introduces a regression.

The repeat mode setting is properly updated in every player except the Main Video player.

If you switch between background and video player while repeat mode is set to anything but off, the video player does not retain the repeat setting as the background player (it shows off when you switch away from video and switch back to it).

This is because in VideoPlayerUi.initPlayback there needs to be a call to set the repeat mode as well as the shuffle, for the same reason that there's a call to setShuffleButton.

Some other less critical changes I will mention soon, but this one is the main blocker.

EDIT: changes you should make

// VideoPlayerUi
@Override
public void initPlayback() {
    super.initPlayback();

    // #6825 - Ensure that the shuffle-button is in the correct state on the UI
    setShuffleButton(player.getExoPlayer().getShuffleModeEnabled());
    // Do same for repeat button
    setRepeatButton(player.getRepeatMode());
}

// ....

@Override
public void onRepeatModeChanged(@RepeatMode final int repeatMode) {
    super.onRepeatModeChanged(repeatMode);

    setRepeatButton(repeatMode);
}

Comment thread app/src/main/java/org/schabi/newpipe/player/Player.java Outdated
@ShareASmile ShareASmile added feature request Issue is related to a feature in the app settings Relating to NewPipe settings database Issue and PRs related to database operations labels Apr 12, 2026
@arjun1194
Copy link
Copy Markdown
Contributor Author

@absurdlylongusername resolved the comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

database Issue and PRs related to database operations feature request Issue is related to a feature in the app settings Relating to NewPipe settings size/small PRs with less than 50 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants