0

我有一个媒体播放器,我想从一个 url 读取音频文件,(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 中是可读的

4

0 回答 0