1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-26 21:29:16 +00:00
mpv/TOOLS/python/ontop-playback.py
2025-04-03 19:40:05 +06:00

22 lines
581 B
Python

# makes mpv disable ontop when pausing and re-enable it again when resuming playback
# please note that this won't do anything if ontop was not enabled before pausing
from mpvclient import mpv
was_ontop = False
@mpv.observe_property("pause", mpv.MPV_FORMAT_FLAG)
def func(value):
ontop = mpv.get_property_node("ontop")
global was_ontop
if value:
if ontop:
mpv.set_property_node("ontop", False)
was_ontop = True
else:
if was_ontop and not ontop:
mpv.set_property_node("ontop", True)
was_ontop = False