Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
467 views
in Technique[技术] by (71.8m points)

c# - Trigger volume buttons to take picture UWP

I try to use a selfie stick, but as windows 10 camera app does not provide the possibility to take picture and record video with it, I was wondering if there is a possibility to trigger and handle when the user presses the volume up and/or down button inside an UWP app

Has anyone be able to achieve this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I was wondering if there is a possibility to trigger and handle when the user presses the volume up and/or down button inside an UWP app

No, hardware Volume controls need special permission for development, if you are an ordinary developer, it is not possible to access these hardware controls, you can refer to Start, Back, Search, Power, and Volume control behavior.

I try to use a selfie stick, but as windows 10 camera app does not provide the possibility to take picture and record video with it.

I'm not sure why is selfie stick doesn't support take pictures and record, some windows phones don't have a camera hardware button, like Lumia 640. But for device like Lumia 950 which has a camera hardware button, the camera hardware button is accessible in UWP app. As you can see from the official Basic camera app sample, it registers the event handlers for hardware buttons of Camera like this:

if (ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
    HardwareButtons.CameraPressed += HardwareButtons_CameraPressed;
}

When use this API, you need to reference Microsoft Mobile Extension SDK for Universal App Platform in your project.

If accessing camera hardware button is not enough for you, my suggestion is that you may submit a request to add this new features for developing through the Windows Feedback tool.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...