Skip to content

Setting time_pos too early makes it stick #311

@pmcgaley

Description

@pmcgaley

Setting time_pos too early appears to succeed but it doesn't actually seek. Playback proceeds from the start of the file, I can observe the property and get correct values that way, but reading player.time_pos is stuck at whatever value I initially set it to.

I thought calling wait_for_property('seekable') before setting time_pos had solved this for me, but in fact I've since seen it happen once even when I make that call.

from mpv import MPV

player = MPV()

def on_time_pos(name, value):
    print(f"time: {value} vs {player.time_pos}")

player.observe_property('time-pos', on_time_pos)

player.play("file.m4b")

# here's where I now call player.wait_for_property('seekable')

player.time_pos = 1.23

player.wait_for_playback()
$ python mpvtest.py 
time: None vs 1.23
time: 0.0 vs 1.23
time: 0.043594991793650784 vs 1.23
time: 0.09264593575283447 vs 1.23
time: 0.1746740883537415 vs 1.23
...

Raspberry Pi OS Trixie
mpv 0.40.0-3+deb13u1
python-mpv 1.0.8
Python 3.13.5

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