How can I add background music that can be played/paused/stopped using app bar
-
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?
Mustzerone
Semua Balasan
-
01 Mei 2012 18:03Moderator
Hi Mus,
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
Jeff Sanders (MSFT)
- Disarankan sebagai Jawaban oleh Jeff SandersMicrosoft Employee, Moderator 01 Mei 2012 18:03
- Diedit oleh Jeff SandersMicrosoft Employee, Moderator 01 Mei 2012 18:05
- Diedit oleh Jeff SandersMicrosoft Employee, Moderator 01 Mei 2012 18:11
- Ditandai sebagai Jawaban oleh mustzerone 01 Mei 2012 23:19
-
01 Mei 2012 23:19thanks
Mustzerone