Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Properly save playlist file positions with --save-position-on-quit #8138

@CyberShadow

Description

@CyberShadow

Currently, the way mpv saves and restores the playback position of a playlist, is that it finds the first playlist entry which has a saved position, and resumes playing that file. However, this logic exhibits unpleasant behavior in some situations:

  • Playing a playlist containing files A,B,C, quitting/saving on C, then playing the individual file A and quitting/saving, causes mpv to resume playing on A when told to resume playing the playlist. The expected behavior is to resume playing C.
  • Playing a playlist containing files A,B,C,D,E, quitting/saving anywhere, then playing another playlist containing files A,C,E, and quitting/saving on any file that's before the current file in the first playlist, confuses mpv when trying to play the first playlist as it tries to resume from the file from the second playlist. The expected behavior is probably that each playlist has its own individual position.
  • Playing a playlist containing files A,B,A, then quitting/saving on the second A, causes mpv to resume from the first A when told to resume playing the playlist.

Expected behavior of the wanted feature

It would be better to replace this heuristic with properly saving the playback position of a playlist file, same as for video files (though counting playlist entry indices instead of time).

Of note is that the current behavior also makes it difficult to implement (either in mpv or as a user script) the option to never delete the currently saved position, and/or save the current position periodically, because lest the remnant / periodically-saved positions are cleaned up in some manner, they interfere with detecting which file in a playlist mpv should resume playback from.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions