The MediaPlayer stops playing randomly. Please Help.

I've been working on a Timer Android app. And at the end of every round it rings a bell .mp3. The app works smoothly with no issues it does the count down and all. But the media player randomly stops playing the bell ( _player) after certain rounds of repeat. Please help me.

Following is the snippet of parts where the media player is implemented. Again, this is not full code but just the media player implementations in the code.

    public class MainTimerActivity : AppCompatActivity
    {

        private static MediaPlayer _10fx, _8fx, _7fx,_6fx,_5fx, _4fx, _3fx, _2fx, _1fx, _player, _player2;

            protected override void OnCreate(Bundle savedInstanceState)
            {
                        base.OnCreate(savedInstanceState);

                        SetContentView(Resource.Layout.Main_Timer);
                        this.Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);
            }

          void TimeBoyMain()
            {
                TIMERFLAG = true;

                if (bbellstring == "true")
                {
                    _player = MediaPlayer.Create(this, Resource.Raw.startding); 
                _player.Start();
                }
            }
}

Thank you!

Answers

  • JohnyKamnangJohnyKamnang BEMember ✭✭

    Hi,

    Have you found any solution? I've got the same problem.. I'm playing an mp3 sample song coming from Deezer. And it stop randomply (after around 10 or 15 samples played)

    Do you have any solution?

Sign In or Register to comment.