01 Mei 2012 14:43how can I add background music to my app that can be played/paused or stopped by user using app bar?
01 Mei 2012 18:03Moderator
The background task and your Metro style program do not have direct way to communicate this information. The background task does not have access to the HTML DOM and so you cannot sync events in the traditional manner.
If you have not already familiarized yourself with this document you should go over this: http://msdn.microsoft.com/en-us/library/windows/hardware/hh770517
You could come up with a scheme to control audio like polling state or socket communications but Transport Controls is the best way to go:
You should review this white paper on System Transport Controls: http://msdn.microsoft.com/en-us/library/windows/hardware/hh833781
(Assuming you mean from a background task) Since your background task needs to implement this hook into the System Transport Controls (it is playing background audio) you get volume controls in a manner that the Metro style app users expect.
Also see this sample: http://code.msdn.microsoft.com/windowsapps/Media-Buttons-ea57d8e2
Jeff Sanders (MSFT)
01 Mei 2012 23:19thanks