B
B
Bogdan Karpov2018-05-22 16:03:00
Python
Bogdan Karpov, 2018-05-22 16:03:00

How to get mp3 track length in seconds via pygame.mixer?

How to get mp3 track length in seconds via pygame.mixer?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2018-05-22
@phpkoder

No way.
apart from this crutch:

from pygame import mixer
mixer.init()
mixer.music.load("file.mp3")
mixer.music.play()
pos = 0
while mixer.music.get_pos() > -1:
    pos = mixer.music.get_pos()

though you have to wait until the track is played
, then the length of the track in milliseconds will be known

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question