MediaPlayer甚至可以播放MP3吗?

时间:2011-05-19 16:37:56

标签: android media-player

我在codejanitor上的网络服务器是不是专为流媒体设计的?或者我做错了什么?

我尝试了以下两种方法:

try {
            mp = MediaPlayer.create(
                    AmazonClipActivity.this, 
                    Uri.parse("http://codejanitor.us/good.mp3"));
            mp.setOnPreparedListener(new OnPreparedListener() {
                @Override
                public void onPrepared(MediaPlayer mp) {
                    mp.start();

                }
            });
        } finally {
            if(mp!=null) {
                mp.release();
                mp =null;
            }
        } 

try {
            mp = MediaPlayer.create(
                    AmazonClipActivity.this, 
                    Uri.parse("http://codejanitor.us/good.mp3"));
            mp.start();
        } finally {
            if(mp!=null) {
                mp.release();
                mp =null;
            }
        } 

AND产生:

05-19 12:27:48.104: DEBUG/MediaPlayer(1730): Couldn't open file on client side, trying server side
05-19 12:27:48.104: INFO/StagefrightPlayer(68): setDataSource('http://codejanitor.us/good.mp3')
05-19 12:27:48.104: INFO/NuHTTPDataSource(68): connect to codejanitor.us:80/good.mp3 @0
05-19 12:27:53.653: INFO/NuCachedSource2(68): ERROR_END_OF_STREAM

1 个答案:

答案 0 :(得分:1)

阅读this主题。没有标记答案,但有一些解决方案可以让MediaPlayer从URL流式传输。