6

Can anybody explain me what's the difference between AudioManager and MediaPlayer in Android ? If I am correct, then AudioManager can only play audio, while MediaPlayer can play both audio and video. But I believe there must be more to this.

Thanks.

Rajat
  • 1,449
  • 5
  • 20
  • 33

2 Answers2

6

AudioManager doesn't play sound at all. It provides access to sound settings, but to play sounds easily, you should use MediaPlayer, SoundPool, or possibly AudioTrack.

From the docs:

AudioManager provides access to volume and ringer mode control.

Geobits
  • 22,218
  • 6
  • 59
  • 103
4

AudioManager is used to manage audio settings. This includes volume control and the streaming channels (e.g. ringer, media, in-call, etc.).

MediaPlayer is used for controlling the playback (e.g. stop, play, pause, etc.) of audio/video streams.

Armin
  • 1,807
  • 20
  • 21