Page 1 of 1

Playmusic and sound length problems

Posted: Sat Nov 23, 2019 1:11 am
by xabierpayet
i have a problem wih playmusic instruction, in android is not possible to know if the song is finished, i have problems with IsMusicPlaying also, in android if you start the music the result ever is True, under windows work fine.
Under windows and android the song length is around 17 seconds more that the real length (17 seconds of blank space), and i need do this to
solve the problem:

dura = GetAttribute(#MUSIC, 100, #ATTRDURATION)
posi = GetAttribute(#MUSIC, 100, #ATTRPOSITION)
plyn = GetAttribute(#MUSIC, 100, #ATTRPLAYING)
dura2=dura-17000
If posi>dura2
StopMusic(100)
musica=0
EndIf
.....

That´s a bug? i´m doing something bad?

Re: Playmusic and sound length problems

Posted: Sat Nov 23, 2019 12:59 pm
by airsoftsoftwair
What format is the music in? MP3? Protracker? WAV? etc.

Re: Playmusic and sound length problems

Posted: Sun Nov 24, 2019 12:59 am
by xabierpayet
Mp3

Re: Playmusic and sound length problems

Posted: Sun Nov 24, 2019 10:53 am
by airsoftsoftwair
Please provide the MP3 so that I can check.

Re: Playmusic and sound length problems

Posted: Sun Dec 01, 2019 12:59 am
by xabierpayet
i have the same problem with evey mp3 song here

Re: Playmusic and sound length problems

Posted: Tue Dec 03, 2019 4:50 pm
by airsoftsoftwair
Sorry, can't reproduce the problem here. For a random test MP3 which is 3 minutes and 4 seconds, #ATTRDURATION returns 184345 when using avcodec.hwp on Windows and 184346 when using DirectShow for MP3 streaming. Both results are very precise and they definitely aren't off by 17 seconds. Also, IsMusicPlaying() on Android returns 0 as soon as the MP3 has finished playing.

If it doesn't work for you, please provide a full test script including data files.