android mediaplayer不会从网址播放wav文件

时间:2013-10-25 16:19:38

标签: android android-mediaplayer

我有一个媒体播放器,我想从网址读取音频文件,(wav格式) 这是代码

public static void startMediaPlayer(String url) {
        try {
            mediaPlayer.reset();
            mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
            mediaPlayer.setDataSource(url);
            mediaPlayer.prepareAsync();

            mediaPlayer.setOnPreparedListener(new OnPreparedListener() {

                @Override
                public void onPrepared(MediaPlayer mp) {

                        mediaPlayer.start();

                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

然后我收到错误

10-25 17:01:45.015: E/MediaPlayer(2e745): Error (-38,0)
10-25 17:01:47.281: E/MediaPlayer(26745): error (1, -1004)

该文件可在VLC中重新编排,但

0 个答案:

没有答案