Array

Acquiring Image and Audio Data on the Phone

Must Read

Admin
Admin
Just post!

The Tailspin Surveys mobile client application allows users to capture images from the device’s camera and record audio from the device’s microphone as answers to survey questions. The application saves the captured data as part of the survey answer, and this data is sent to the Tailspin Surveys web service when the user synchronizes the mobile client application.

Overview of the Solution

The techniques you use to capture audio and image data are different. To capture image data from the camera, you use a “chooser,” and to capture audio data from the microphone, you must use interop with the XNA® framework on the phone.

For more information about these techniques, see Appendix C, “Leveraging Device Capabilities.”

Capturing Image Data

The chooser for capturing image data is the CameraCaptureTask. When you use a chooser, the operating system deactivates your application and runs the chooser as a new process. When the chooser has completed its task, the operating system reactivates your application and delivers any data to your application using a callback method.
The developers at Tailspin chose to implement this using the Observable class from the Rx library on the phone. The Tailspin Surveys mobile client application saves the captured picture to isolated storage along with the other survey answers and also displays the picture in the view.

Recording Audio Data

To access the microphone on the Windows Phone 7 device, you have to use XNA; it’s not possible to access it directly from Silverlight. To interoperate with XNA, you must use an XNA asynchronous event dispatcher to connect to the XNA events from Silverlight. Your application can then handle the microphone events that deliver the raw audio data to your application. Your application must then convert or encode the audio data to a valid sound format before saving the audio data in isolated storage.

Inside the Implementation

Now is a good time to walk through the code that captures image data and records audio in more detail. As you go through this section, you may want to download the Visual Studio solution for the Tailspin Surveys application from CodePlex (http://go.microsoft.com/fwlink/?LinkId=205602).

 

- Advertisement -

Latest News

Elevate Your Bentley Experience: The Bespoke Elegance of Bentayga EWB by Mulliner

Bentley Motors redefines the essence of bespoke luxury with the introduction of the Bentayga EWB's groundbreaking two-tone customization option—a...
- Advertisement -

More Articles Like This

- Advertisement -