So I am working on a music player using FMOD. I am currently using the natively given C# Wrapper and everything seems to work fine. There are no exceptions, no errors. But when I play some music on Windows Phone and minimize the app, the music just pauses. On going back to the app, the music resumes.
It is to be noted that all related capabilities are on (i.e. backgroundMediaPlayback). The weird thing is once I leave the background and go back to the app and try again minimizing the app, the music continues without a hitch.
I debugged the code quite a bit and found that the app was being suspending as soon as it hit the background. How do I avoid suspending the app?
One other thing to note is that BASS.NET works without the use of BackgroundTasks and on the same code. I register my manual SMTC too but no luck so far.
//create a stream of the new track Result loadResult = _fmodSys.CreateStream(mediaFile.Path, _isMobile ? Mode.LowMem & Mode.IgnoreTags : Mode.Default, out _fmodSound); //load the stream into the channel but don't play it yet. loadResult = _fmodSys.PlaySound(_fmodSound, null, true, out _fmodChannel);
here’s my SMTC code:
_smtc = SystemMediaTransportControls.GetForCurrentView(); _smtc.ButtonPressed += _smtc_ButtonPressed; _smtc.IsEnabled = true; _smtc.IsPlayEnabled = true; _smtc.IsPauseEnabled = true; _smtc.IsStopEnabled = true; _smtc.IsNextEnabled = true; _smtc.IsPreviousEnabled = true; _smtc.PlaybackStatus = MediaPlaybackStatus.Closed; _smtc.AutoRepeatMode = MediaPlaybackAutoRepeatMode.Track;
I hope you can give a hint as to how I can possibly continue the playback when in background.
NOTE: Background Audio works fine on Windows 10 PC.