Hyundong Hwang
Hyundong Hwang

Reputation: 781

How can I use CameraTask or PhotoChooser in window phone 8.1?

I'm developing a WP81 app, and I have some troble in capturing image from camera. I want to capture camera or select photo in piture hub with simple method like WP71's CameraTask or PhotoChooser. But I cannot find any other similar method in WP81's sdk. Does anyone know the similar apis?

WP71's CameraTask, PhotoChooser api: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394006(v=vs.105).aspx

WP81's raw and complicated camera api: http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn642091.aspx

Upvotes: 3

Views: 5510

Answers (2)

Jon B
Jon B

Reputation: 885

You can use

FileOpenPicker picker = new FileOpenPicker();
Helpers.FillDecoderExtensions(picker.FileTypeFilter);
picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;

Which opens the File Open picker, set to images, which gives the option of capturing a fresh image.

See http://channel9.msdn.com/Events/Build/2014/2-525 for more info.

Upvotes: 2

Andres Talavera
Andres Talavera

Reputation: 2210

Your link to WP71's Api works on Windows Phone (7 & 8).

For Windows Phone 8.1, I've find this : http://msdn.microsoft.com/en-us/library/windows/apps/dn376408.aspx but the CameraCaptureUI control is not available on Windows Phone 8.1 devices. Use the lower-level Windows.Media.Capture API instead: see Quickstart: capturing video by using the MediaCapture api for more information.

Momentarily, you can use IoC pattern (if you have different projects, an interface on your common project, and 2 classes on your specific platforms projects, that inherit from the interface - and you call your methods on common project) or if directives

Upvotes: 1

Related Questions