Playback hangs when loadfile input command is used from script
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 37k
- Forks
- 3.5k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 22
Description
mpv Information
mpv v0.40.0-61-g44816ef8f Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
built on Apr 13 2025 13:53:36
libplacebo version: v7.350.0 (v7.349.0-65-g2bd627f8)
FFmpeg version: N-119224-gbf327ac676
FFmpeg library versions:
libavcodec 62.0.101
libavdevice 62.0.100
libavfilter 11.0.100
libavformat 62.0.100
libavutil 60.1.100
libswresample 6.0.100
libswscale 9.0.100
Other Information
- Linux version: Ubuntu 24
- GPU Model: NVIDIA GT 1030
- Window Manager and Version: Gnome X11
- Source of mpv: mpv-build current master
- Latest known working version: v0.39
Reproduction Steps
When I call loadfile from script from key binding, the video file opens, but it doesn't play, it hangs at position 0, the play/pause button indicates it's playing, nothing happens when pressing the button, it starts playing when the seek bar is clicked.
It works correctly when I call loadfile from the console.
The logic of the code is to cycle pause if the playlist isn't empty, if the playlist is empty, a defined video folder is loaded.
It worked with v0.39.
The code:
mp.register_script_message("cycle-pause", function ()
local count = mp.get_property_number("playlist-count")
if count > 0 then
mp.command("cycle pause")
else
if is_windows then
mp.command("loadfile 'E:\\Video\\YouTube'")
else
mp.command("loadfile '/mnt/Media/Video/YouTube'")
end
end
end)
Expected Behavior
Video file plays.
Actual Behavior
Video playback hangs.
Log File
Sample Files
No response
I carefully read all instruction and confirm that I did the following:
- I tested with the latest mpv version to validate that the issue is not already fixed.
- I provided all required information including system and mpv version.
- I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of
--log-file=output.txt. - I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
- I attached the full, untruncated log file.
- I attached the backtrace in the case of a crash.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the shown Lua script-message callback and loadfile command, then inspect the script-message and loadfile entry points while comparing v0.39 with v0.40. Use the attached log to trace why playback remains at position 0; done means the file begins playing from the key binding without clicking the seek bar.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, lua
- Domain
- cli, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100