Windows Phone: MediaElement not playing file and failing with Error code 3123

Recently I had very frustrating error and I thought I must blog it to save someone else time. I used MediaElement in Windows Phone to play audio files (*.mp3 in my case). Suddenly one of my change broke it and it stop playing sound. After hooking up MediaFailed event … I found it was giving me message

3123 An error has occurred.

        private void Play_Click(object sender, RoutedEventArgs e)
        {
            //Auto play will start playing file when you assign new source
            player.AutoPlay = true;
            player.Volume = 1.0;
            player.Source = new Uri("/Assets/Audio/Alpha1/1.mp3", UriKind.RelativeOrAbsolute); 
        }

        private void player_MediaOpened(object sender, RoutedEventArgs e)
        {
            player.Play();
        }

        private void player_MediaFailed(object sender, ExceptionRoutedEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(e.ErrorException.Message);
        }

If you ever face this such error where MediaElement does not produce sound on play then first thing to check is your WMAppManifest.xml file and see you have following capability in the file. In my case it was not there and as soon as I added it everything started working
 

      <Capability Name="ID_CAP_MEDIALIB" />

Hope this saves you some frustration.
Cheers!!!

Binary World is a Software Development company located in Atlanta, USA (since 2007). Binary World specialized in Business Intelligence, mobile, cloud computing and .Net Application Development.

Leave a Reply