locked
How can i use device hardware buttons(Play/Pause) in the app? RRS feed

  • Question

  • Hi,

    am developing a Windows 8.1 store app.

    In my app am playing some music. Whenever user taps Play/Pause button in the app am able to play/pause it.

    But in the PC when i hit the Play/Pause button it should perform the appropriate tasks. How  can i handle that?

    Anybody please help me??

    Thanks in advance.

    Monday, May 19, 2014 8:37 AM

Answers

All replies

  • I'm not sure about this, but you may be able to handle the VirtualKey to see what is being sent when those keys are pressed, and perform the appropriate action.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.


    Monday, May 19, 2014 12:32 PM
    Moderator
  • They will come in as normal key strokes. They aren't in the VirtualKey enumeration but you can look up their numeric ivalues in the desktop Virtual-Key Codes documentation: VK_MEDIA_PLAY_PAUSE is 0xB3

    Also look at the media transport controls for background media. http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn263187.aspx

    Monday, May 19, 2014 12:58 PM
    Moderator