dedual
dedual

Reputation: 153

Camera capture in Windows Phone 7 through an XNA application

I know that Microsoft hasn't officially supported doing any video capture applications as of yet. I've found the Clarity Consulting blog entry that highlights how to use the camera through Silverlight (entry is here: http://blogs.claritycon.com/kevinmarshall/2010/12/23/wp7-camera-access-flashlight-augmented-reality-and-barcode-scanning/). But, as of yet, I have been unsuccessful in porting the code to be used by an XNA framework.

Has anyone had any luck either using the Windows Phone 7 camera in an XNA application? If so, care to share your wisdom?

Thanks!

Upvotes: 2

Views: 2293

Answers (3)

Reza M.
Reza M.

Reputation: 1223

Think you are a bit unclear about the whole microsoft and supporting cameras.

Microsoft released not too long ago Expression Encoder 4 which allows you not only to video screen capture your screen but as well access all devices connected to your pc.

I would believe this would be much more ideal then being restrained to only using a windows 7 phone especially for an xna game.

Hope this sheds some light.

Upvotes: 0

Den
Den

Reputation: 16826

Generally you can access the camera the same way you do it in Silverlight - there is the CameraCaptureTask - you need to add a reference to Microsoft.Phone first and then call it from the game.

Microsoft.Phone.Tasks.CameraCaptureTask task = new Microsoft.Phone.Tasks.CameraCaptureTask();
task.Completed += new EventHandler<Microsoft.Phone.Tasks.PhotoResult>(task_Completed);
task.Show();

That would be for static capture, and your event handler is like this:

void task_Completed(object sender, Microsoft.Phone.Tasks.PhotoResult e)
{
    // Do something with e.ChosenPhoto
}

Currently, video recording is done through the undocumented way - this will most likely get your app submission disapproved from the Marketplace, but it is possible nonetheless.

What's done that way is a MP4 file is constantly updated in the IsolatedStorage as the recording is in progress. But then again, there are methods present to include the file in the media library.

Upvotes: 1

Related Questions