Android Question Android 5.0 media player behaviour

Arf

Well-Known Member
Licensed User
I updated my nexus7 to Android 5.0 last night, and checked my app still worked.
It does, but not 100%. the app usually plays a series of clicks when something spins, and that's not working any more.

My code for playing the tick looks like this below - what I want to know is, would my Do While loop (that waits for the tick to finish playing) have any effect? I thought maybe since it blocks execution it may be optimised out by the compiler or something.

B4X:
Sub PlayTick
    MP.Initialize ()
    MP.Load(File.DirAssets, "tick.wav")   
    MP.Play   
    Do While MP.IsPlaying
    Loop
End Sub
 

Arf

Well-Known Member
Licensed User
Thanks Erel,
Just for my education - is this the best strategy to adopt:
Initialise MP once only, in Service_Create
Load a sound file, play it.
If I need to play that sound again, just play it again (after I know the first play has ended) without re-loading it.
If I need to play a different sound, I just load the different sound and play it, no need for re-init?
 
Top