O'Reilly logo

Windows Application Development Cookbook by Marcin Jamro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Playing an audio file

In a similar way to the case of movies, your applications can also play audio files. Such content may be really useful, for example, in the case of long descriptions that may be cumbersome for users to read. By using audio recordings, they can easily listen to them in earphones while walking or going to work by bus. Playing audio files is very simple due to availability of the MediaElement control, as you will see in this recipe.

As an example, you will create a simple page with the Play audio button. After clicking on it, the audio recording should be started or stopped, depending on its current state.

Getting ready

To step through this recipe, you need only the automatically generated project.

How to do it...

To prepare an example ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required