Pages

Tuesday 17 July 2012

Playing a embedded media file (mp3) in WinRT (not via Xaml but with C#)

When building WinRT applications it is going to be pretty common to want to play some sort of embedded audio file.  It may also be common to want to play this file but via a ViewModel (or simply not in a view).  In this post we are going to take a quick look at how to play an MP3 file by using the MediaElement control, but we will NOT be doing this via XAML, we will be doing via straight up code.  The reason I am not using XAML here is because i don’t want to limit the places or times I can play audio, also I want to trigger the playing of the file via my ViewModel.

Before we get coding lets assume we have an audio file embedded in our application under the /Assests/SoundFiles folder and the file name is ding.mp3

Read full article here

1 comment:

  1. The main thing about the paper is bestessaywriting.org that it is an artistic work that is indefinable in nature. It is an unquestionably a sort of writing,

    ReplyDelete

Web Informer Button