Kivy Audio Will Not Seek, Win 11
08:16 18 Nov 2021

According to the documentation Kivy 2.0.0 audio will likely not seek unless played first. However, I cannot get it to seek at all with this simple code on Windows 11. It always plays from the beginning and the position is always 0,

from kivy.core.audio import SoundLoader
from kivy.clock import Clock

sound = SoundLoader.load('test.mp3')

def play():
    sound.play()
    sound.seek(5)
    print(sound.get_pos())
    
if sound:
    print("Sound found at %s" % sound.source)
    print("Sound is %.3f seconds" % sound.length)
    #Clock.schedule_once(play, .3)
    
    play()

Also, I tried to schedule a delay using Clock and the audio does not play at all. What am I missing?

Edit:

It was suggested that this code needs to be wrapped in an app to work. That did fix the clock delay issue, but the player still will not seek ahead,

from kivy.core.audio import SoundLoader
from kivy.clock import Clock
from kivy.app import App
from kivy.uix.button import Button

class MainApp(App):
    sound = SoundLoader.load('test.mp3')

    def build(self):
        return Button(text='Play', on_press = self.clock)

    def clock(self, evt):
        Clock.schedule_once(self.play, 1)
    
    def play(self, evt):
        self.sound.play()
        self.sound.seek(5)
        #self.sound.play()
        print(self.sound.get_pos())

MainApp().run()
python audio kivy