Hey !
Somehow, I am unable to get mediaplayer to fire "complete" event.
It stops after playing first audio file.
Would be nice if someone can point out what am I doing wrong here.
My service module code is like this:
Somehow, I am unable to get mediaplayer to fire "complete" event.
It stops after playing first audio file.
Would be nice if someone can point out what am I doing wrong here.
My service module code is like this:
Service Module:
#Region Service Attributes
#StartAtBoot: False
#End Region
Sub Process_Globals
Private nid As Int = 1
Private lock As PhoneWakeState
Private pl As MediaPlayer
End Sub
Sub Service_Create
lock.KeepAlive(False)
pl.Initialize2("mp")
End Sub
Sub Service_Start (StartingIntent As Intent)
Service.StopAutomaticForeground
End Sub
Public Sub Play
Service.StartForeground(nid, CreateNotification("Playing music - Radio Paradise"))
Dim rp As RuntimePermissions
for xx = 1 to 10 'there are 10 mp3 files like 1.mp3, 2.mp3 and so on
pl.Load(rp.GetSafeDirDefaultExternal("mp3"), xx & ".mp3")
pl.Play
next
End Sub
Sub mp_Complete
Log("Playing complete")
End Sub
Public Sub Stop
pl.stop
Service.StopForeground(nid)
lock.ReleaseKeepAlive
End Sub
Sub CreateNotification (Body As String) As Notification
Dim notification As Notification
notification.Initialize2(notification.IMPORTANCE_LOW)
notification.Icon = "icon"
notification.SetInfo("Playing Audio...", Body, Main)
Return notification
End Sub
Sub Service_Destroy
pl.stop
lock.ReleaseKeepAlive
End Sub