Android Question Mediaplayer on Asus Memopad HD

g7jjf

Member
Licensed User
Longtime User
I have written a small program which acts as a countdown timer that plays a 'tick' wave file each second.

The program works fine on a Samsung S2 and S3 and Nexus 7 but when I run it on the Memopad, the program only sounds the first tick then nothing else.

The tick is played in the timer routine as shown :

B4X:
Sub timer1_tick
    If count > 0 Then
        If PlaySound = True Then
            MediaPlayer1.Play
        End If
        count = count - 1
        showtime
        If count = 0 Then
            MediaPlayer2.Play
            timer1.Enabled = False
            btnStart.Enabled = False
            btnStop.Enabled = False
            btnReset.Enabled = True
        End If
    End If
End Sub

I can't understand why only the first tick is played. The wave is less than one second in duration so successive play's won't overlap.

Anyone any ideas what the problem may be ?

Thanks,

Jon.
 

g7jjf

Member
Licensed User
Longtime User
I added a Complete event to the MediaPlayer by adding :
B4X:
Sub MediaPlayer1_Complete
  MediaPlayer1.Stop
  MediaPlayer1.Load(File.DirAssets, "tick.mp3")
End Sub

and this made it work.

Thanks for your help.

Jon.
 
Upvote 0
Top