Skip to content

Toggling pause when idle causes error #16

@escapezn

Description

@escapezn

When mpv is idle, if pause got touched just by pressing SPACE unconsciously, it will report errors like this

[SimpleUndo]
[SimpleUndo] stack traceback:
[SimpleUndo]    mp.defaults:397: in function 'handler'
[SimpleUndo]    mp.defaults:500: in function 'call_event_handlers'
[SimpleUndo]    mp.defaults:534: in function 'dispatch_events'
[SimpleUndo]    mp.defaults:493: in function <mp.defaults:492>
[SimpleUndo]    [C]: at 0x00f82de0
[SimpleUndo]    [C]: at 0x00f817f0
[SimpleUndo] Lua error: [string ".../mpv/portable_config/..."]:64: attempt to index global 'timer' (a nil value)

I tried editing script, seems working for now

mp.observe_property('pause', 'bool', function(name, value)
	if timer ~= nil then

	if value then
		timer:stop()
		pause = true
	else
		-- if timer ~= nil then
			timer:resume()
		-- end
		pause = false
	end
end
end)

Please check and fix it up, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions