diff --git a/components/audio_mp3/audio_mp3.c b/components/audio_mp3/audio_mp3.c index b35bf8e63a71a6687e09eed45a0bd7247cbedd0e..e7f06636d579f6ba026b415df4e28a2da8a59d61 100644 --- a/components/audio_mp3/audio_mp3.c +++ b/components/audio_mp3/audio_mp3.c @@ -152,6 +152,12 @@ static void mp3_think(st3m_media *media, float ms_elapsed) { if (self->control.paused) return; + if (self->file) { + self->control.position = self->offset; + if (self->offset + 512 >= self->file_size) + self->control.position = self->file_size; + } + if (!self->started) { self->started = 1; mp3_think(media, 100); @@ -373,6 +379,6 @@ st3m_media *st3m_media_load_mp3(const char *path) { return NULL; } mp3dec_init(&self->mp3d); - self->control.duration = -1; + self->control.duration = self->file_size; return (st3m_media *)self; }