Freigeben über


Camera and photos for Windows Phone 8

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

This section describes how your app can capture photos and video on Windows Phone. It also shows how your app can save photos to the media library and use extensibility to extend the camera and photos experience.

This topic contains the following sections.

Using a Chooser

If capturing photos is not the central feature of your app, you may want to consider using the built-in camera app to capture photos for your app. This functionality is exposed with the camera capture task. The camera capture task lets your users capture a photo using the built-in camera app. After the photo is captured, it’s passed back to your app in an event handler. For more info, see How to use the camera capture task for Windows Phone 8.

You can also use the photo chooser task to give your users the ability to select photos from the media library. For more info, see How to use the photo chooser task for Windows Phone 8.

Using the camera directly

For direct access to the camera, your app can use the camera APIs. A Windows Phone can have up to two cameras: one on the front of the phone and one on the back. Although both cameras are fairly common on today’s phones, technically they are optional, so your app should check that they exist before attempting to use them. For more info about capturing photos and video, see the following topics:

Creating a lens app

Windows Phone 8 introduces a new class of applications: Lenses. Similar to how you can switch to a different physical lens on an SLR camera, you can switch to a lens app on a Windows Phone. From the built-in camera app, use the lens button to switch to another camera app that provides a viewfinder experience. For more info, see Lenses for Windows Phone 8.

Saving photos to the media library

Your app can save photos to the phone’s media library or to the app’s local folder (previously known as isolated storage). To save photos to the media library, use the MediaLibrary class in the Microsoft.Xna.Framework.Media namespace. The MediaLibrary SavePictureToCameraRoll() and SavePicture() methods save photos to the Camera Roll and Saved Pictures folders. For an example, see How to create a base camera app for Windows Phone 8.

Saving photos to the local folder

As with other application data, your app can save photos to the local folder of your app. For an example, see How to create a base camera app for Windows Phone 8. For more info about data storage, see Data for Windows Phone 8

Automatically uploading photos to a web service

Your app can also save photos to a location off of the phone. Starting in Windows Phone 8, you can write an app that automatically uploads photos to a photo storage service. For more info, see Auto-upload apps for Windows Phone 8.

Extending the photos experience

On Windows Phone, photo extensibility provides ways for your app to extend the photos experience. Your app can integrate with the following extension points:

  • Photos Hub

  • Share picker

  • Rich media app

  • Photo edit picker

  • Photo apps picker

For more information, see Photo extensibility for Windows Phone 8