• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Android studio reset media player after playing

fckedup

Lurker
Creating an app where when user touches picture it plays a audio file of about 2 or 3 second explaining the content of the picture.

I have 5 activities that use a FlipperView to display the images, I am using the following code to play the audio
final MediaPlayer playciSoundMP = MediaPlayer.create(this, R.raw.XXX);

ImageView imageView37 = (ImageView) this.findViewById(R.id.imageView37);
imageView37.setOnClickListener(new View.OnClickListener() {

@override

public void onClick(View v) {playciSoundMP.start();

}
});

All works well when used on nexus 6P but when used on Huawei P9 or Huawei M9 after about 14 or 15 audio plays the audio stops, everything else still works. Have to stop the app and restart it to get audio back.

What have I done wrong?
 
Back
Top Bottom