Stopping Music Player?

choffi

Member
Licensed User
Longtime User
Hi.

I am using a MediaPlayer object to play some music during my game. If I exit the application cleanly (e.g. by using ExitApplication) then the music stops. However if I exit by pressing the Home button then the music keeps playing.

My code is:

mp.Initialize()
mp.Load(File.DirAssets, "theme.mp3")
mp.Looping = True
mp.SetVolume(.5,.5)
mp.Play

If I could trap the application exit event I could stop the music myself but I saw in another thread that that is not possible.

Any ideas?

Thanks.

Mark.
 
Top