Android - MediaPlayer Buffer Size in ICS 4.0

早过忘川 提交于 2019-11-28 16:12:08
ajacian81

Would it be possible to see the code where you're start()ing the MediaPlayer?

Are you using the STREAM_MUSIC audio stream type?

player.setAudioStreamType(AudioManager.STREAM_MUSIC);

Have you also experimented between player.prepareAsync(); and player.prepare();?

There was a similar issue last year I remember, where the solution was to: start, pause and then onPrepared to start():

player.setAudioStreamType(AudioManager.STREAM_MUSIC); 
player.setDataSource(src); 
player.prepare(); 
player.start(); 
player.pause(); 
player.setOnPreparedListener(new OnPreparedListener() {     
@Override
                public void onPrepared(MediaPlayer mp) {
                    player.start();                
                }
          });

Unlikely to be the fix in this case, but while you're spinning your wheels this might be worth a shot.

For me the solution was to use MediaCodec with AudioTrack, I found all I need to know here:

This could be a solution: http://www.piterwilson.com/blog/2014/03/15/mediacodec-mediaextractor-and-audiotrack-to-the-rescue/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!