Skip to content

Windows Phone 8: Photo and Lens Apps (build video)

I love the content that came out of the build conference last month. However, while I learn a lot from the videos, it feels like the information is trapped in a 40-50 minute video and, frankly, no one has that kind of time. So as I watch the videos, I’m taking notes to help me navigate to the parts I need when I come back to them later.

Notes for Windows Phone 8: Photo and Lens Apps (Eric Bennett)

0:00 – 1:00 – Lens apps are for creating “more than photos”. “Building a lens, new camera api, sharing and editing”

1:00 – 5:00– Demo 1 – opens the camera and opens Photosynth (which is about creating panoramas – must download). No code in this demo.

7:30– What makes a lens a lens. Lenses can be built with XAML with C# for UI (but have access to C++).

12:00 – There is a Photos_Rich_Media_Edit Extension as well (launches a “RichMediaEdit” in the URI and a file token for identification). There is the possibility of saving the raw image at the time of capture and then edit it in a different way later on. Look for “Lens Design Guidelines” on MSDN

19:00 – 23:00– Demo 1 – Coding a lens –

WMAppManifest.xml

  • Flips ID_CAP_ISV_CAMERA, ID_CAP_MEDIALIB_PHOTO
  • Adds Requirements for front and rear cameras
  • Adds Extension stuff (Camera_Capture_App and Photos_Rich_Media_Edit)

Shows the UriMapper in the App.xaml.cs

(back to presentation, doesn’t run the app at this point)

23:00 – showing the WP8 imaging apis (captureSequence) better access to preview and video streams (and C++ for existing imaging libraries). These are in Windows.Phone.Media.Capture

24:30 – the api stack as an image (native , sensors, as well as the capture apis)

26:00 – sensor changes – SetProperty(property, value)

GetSupportedPropertyRange(sensorLocation, property)

Can set

  • Exposure Compensation
  • Exposure Time
  • ISO (sensitivity)
  • White Balance (in Kelvin)
  • White Balance Preset
  • Scene Mode
  • Flash Mode
  • Flash Power

Really powerful for photo-focused applications.

28:00– Capture Sequences – can apply properties just at the time of capture

Open => create => specify => prepare => capture => process => save

30:00 – 39:00back into demo

MainPage.xaml.cs – Check to see that the camera exists, loads the camera

(uses PhotoCaptureDevice)

photoCam = await PhotoCaptureDevice.OpenAsync(CameraSensorLocation.Back, supportedResolution[0]);
photoCam.SetProperty([camera sound plays]);
viewfinderBrush.SetSource(photoCam);

takePhoto()
{
	CameraCaptureSequence _capSequence = photoCam.CreateCaptureSequence();
	_capSequence.Frames[0].DesiredProperties[KnownCamerPhotoProperties.ExposureCompensation] = 12;
	//(also sets the mode)
	// need to check to see if these values are supported before we set them.
	MemoryStream imageStream = new MemoryStream();
	_capSequence.Frames[0[.CaptureStream = imageStream.AsOutputStream();
	await photocam.PrepareCaptureSequnceAsync(_capSequence);
	imageStream.seek(0, SeekOrigin.Being);
}

There is a SampleLabs project(thank God)

39:30– Lots of other stuff in this slide, preview Audio/Video APIs, Live Preview Pixels, Photo/AudioVideoCaptureDevice

GetPreviewBufferY(), GetPreviewBufferArgb(), GetPreviewBufferYCbCr()

AudioVideoCaptureDevice Capture/Streaming

“VideoTorch” access ???

41:00– Sharing and Editing

43:25– auto upload background agents (in the background but only WiFi)

45:00– additional resources (documentation, Sample Code on MSDN

BasicLensWP8CS

MediaViewerSample (can’t find on MSDN)

Trying to build a lens in the emulator (you can do some stuff, but not very much)

47:00– talk ends, questions begin

These are phone specific APIs