Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mpv-continue logo

mpv-continue

Lua script for mpv that asks whether to resume playback from a saved watch-later position.


Overview

mpv-continue works with mpv's built-in watch-later system. When mpv opens a file with a useful saved position, the script pauses at the beginning and shows a small prompt:

mpv-continue resume prompt

Choosing continue seeks to the saved timestamp. Choosing start over clears the old watch-later entry and starts from 0:00.

The script does not keep a separate playback history database.

Features

  • Uses mpv's native watch-later files.
  • Shows a resume prompt only when the saved position is useful.
  • Ignores very early saved positions.
  • Skips short files.
  • Clears positions that are close to the end of a file.
  • Temporarily locks normal key bindings while the prompt is open.
  • Supports keyboard and mouse selection.
  • Provides configurable thresholds, timeout behavior, and UI scale.

Installation

Copy the script into your mpv config directory.

Linux / macOS

mkdir -p ~/.config/mpv/scripts ~/.config/mpv/script-opts
cp scripts/mpv-continue.lua ~/.config/mpv/scripts/
cp script-opts/mpv-continue.conf ~/.config/mpv/script-opts/

Windows

Copy:

scripts/mpv-continue.lua

to:

%APPDATA%\mpv\scripts\mpv-continue.lua

Optional config:

script-opts/mpv-continue.conf

goes to:

%APPDATA%\mpv\script-opts\mpv-continue.conf

To let mpv save positions automatically on quit, enable watch-later in mpv.conf:

save-position-on-quit=yes

You can also use mpv's built-in quit-watch-later command, commonly bound to Shift+Q.

Controls

Key Action
Enter Select the focused prompt button
Y Continue from the saved position
N / Esc Start from the beginning
Left / Right Change the focused prompt button
Mouse click Select a prompt button

Behavior

When a file is opened, mpv restores its watch-later state first. The script then checks the restored position.

Condition Result
No saved position Playback starts normally
Saved position is below min_resume_seconds Position is cleared
File duration is below min_file_seconds Position is cleared
Saved position is near the end Position is cleared
Saved position is usable Prompt is shown

If start over is selected, the script can temporarily disable save-position-on-quit until playback passes min_save_seconds_after_start_over. This prevents mpv from immediately saving a new tiny position after restarting a file.

Configuration

Create or edit:

~/.config/mpv/script-opts/mpv-continue.conf

On Windows:

%APPDATA%\mpv\script-opts\mpv-continue.conf

Default configuration:

enabled=yes

min_resume_seconds=60
min_file_seconds=240
ignore_if_remaining_seconds=300
ignore_if_percent_watched=95

pause_on_prompt=yes
resume_after_choice=yes

prompt_timeout=0
default_action=start_over

show_progress_bar=yes
prompt_width_ratio=0.74
prompt_max_width=960
prompt_min_width=520
scale=1.0
mouse_enabled=yes

allow_network=no
min_save_seconds_after_start_over=60
prevent_near_end_save=yes
Option Description
enabled Enable or disable the script
min_resume_seconds Minimum saved position required to show the prompt
min_file_seconds Minimum file duration required to show the prompt
ignore_if_remaining_seconds Clear positions with this many seconds or less remaining
ignore_if_percent_watched Clear positions at or above this watched percentage
pause_on_prompt Pause playback while the prompt is visible
resume_after_choice Resume playback after a choice is made
prompt_timeout Automatically choose after this many seconds; 0 disables timeout
default_action Action used when prompt_timeout is enabled
show_progress_bar Show progress in the prompt
scale Additional UI scale multiplier
mouse_enabled Allow mouse selection
allow_network Allow prompts for network paths
prevent_near_end_save Avoid saving positions near the end

Notes

mpv applies watch-later data early while loading a file. Lua scripts cannot show a prompt before that restore happens, so this script captures the restored position, seeks back to the beginning, pauses, and then displays the prompt.

The script uses mpv's own watch-later commands, including delete-watch-later-config and write-watch-later-config.

License

MIT. See LICENSE.

About

a minimal mpv script that asks whether to continue from the last saved position or start over.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages