locked
App failing on suspension and media controls

    Question

  • We are creating an app that plays background audio. We are currently using a direct x based audio engine. We have experienced a problem in which the app will fail certification because the app will not suspend while the engine is active.

    We have a workaround in place that will stop the engine by calling StopEngine on the IXAudio2 object if no audio is being played that allows the application to suspend properly. This will now pass app certification for suspension, but then it fails because stopping the engine in that way causes the media overlay to disappear. The overlay I'm referring to is the one that pops up when using media keys on the keyboard.

    We're out of ideas on this one and looking for some direction or guidance on how to properly allow suspension with direct x audio while not messing up anything else.

    Thursday, August 30, 2012 10:00 PM

Answers

  • I just wanted to provide a quick update. We found that the audio engine we were using had two different audio sources running (one for sound effects and one for background music). Setting both of the sources to AudioCategory_BackgroundCapableMedia seemed to fix the issue we were having with the media transport controls.

    In order to allow the app to suspend, the fix remains the same. That is to say that we had to manually stop both sources before the system would suspend the application.

    The audio engine we used is CocosDenshion from cocos2d-x: http://www.cocos2d-x.org/news/54
    • Edited by trey9 Friday, September 7, 2012 4:52 PM
    • Marked as answer by trey9 Friday, September 7, 2012 5:28 PM
    Friday, September 7, 2012 4:27 PM

All replies

  • Hello,

    You do need to stop the XAudio 2 engine when your app is signaled that it will be suspended. If you look at any of the DirectX samples they show how to handle this appropriately.

    Unfortunately I don't understand what you mean by "media overlay to disappear". Can you please clarify?

    Application lifecycle (Metro style apps)

    http://msdn.microsoft.com/en-us/library/windows/apps/hh464925.aspx

    Guidelines for app suspend and resume (Metro style apps)

    http://msdn.microsoft.com/en-us/library/windows/apps/hh465088.aspx

    Thanks,

    James


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Friday, August 31, 2012 11:20 PM
    Moderator
  • The "media overlay" I'm referring to is the media controls that pop up when using play/pause, next, previous, or volume keys on the keyboard. Stopping the XAudio2 engine causes the playback controls to disappear leaving only the volume control. Starting the engine again causes them to reappear. We believe the app is failing certification because of this.


     
    Monday, September 3, 2012 2:33 PM
  • James,

    I've been working with the team that's developing this app, so I've done some testing for them.

    I think the issue is that without stopping the XAudio2 engine, the app doesn't suspend, for which the app fails certification. However, if the XAudio2 engine is stopped, the media transport controls (next/pause/prev - which appear along with the volume slider when you tap the volup/voldown keys, for example) disappear when the XAudio2 engine is stopped. As a result, it is then impossible to unpause the audio without returning to the app itself, which is also causing the app to fail certification.

    So what the team needs is help understanding how to properly pause the audio in such a way as to allow the app to suspend, while still having the media transport controls remain, so that the audio may be unpaused without having to go back to the app.

    There are good code samples available for doing this with JavaScript and the <audio> tag, but unfortunately, there don't appear to be any clear examples that combine the use of XAudio2, background audio support, media transport controls, and app lifecycle events. A good code example of the right way to do this would go a long way here. :)

    PS to Trey...I'm the Developer Evangelist who's been working with Todd on helping with questions on porting the app and getting it through the store cert process. Hopefully, we're getting close.

    Monday, September 3, 2012 4:11 PM
  • This is precisely the issue. I have not found an example of using XAudio2, background audio support, and media transport controls together. Thanks for clarifying that and all your help.
    Monday, September 3, 2012 5:21 PM
  • I just wanted to provide a quick update. We found that the audio engine we were using had two different audio sources running (one for sound effects and one for background music). Setting both of the sources to AudioCategory_BackgroundCapableMedia seemed to fix the issue we were having with the media transport controls.

    In order to allow the app to suspend, the fix remains the same. That is to say that we had to manually stop both sources before the system would suspend the application.

    The audio engine we used is CocosDenshion from cocos2d-x: http://www.cocos2d-x.org/news/54
    • Edited by trey9 Friday, September 7, 2012 4:52 PM
    • Marked as answer by trey9 Friday, September 7, 2012 5:28 PM
    Friday, September 7, 2012 4:27 PM