2

我的 MediaPlayer 有问题。就在我设置数据源时,我得到了错误:

02-22 21:26:10.050: E/MediaPlayer-JNI(7332): setDataSource: outside path in JNI is �x@

我的设备是 Samsum Galaxy Advance 和我的代码:

try {
      mediaPlayer.reset();
      mediaPlayer.setDataSource(audioFile);
      mediaPlayer.prepare();
      mediaController.show();
      mediaPlayer.start();
    } catch (IllegalArgumentException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (SecurityException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (IllegalStateException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
4

1 回答 1

0

尝试这样设置数据源路径,并以这种方式使用mediacontroller:

String audioFile= Environment.getExternalStorageDirectory().getAbsolutePath();
audioFile+="/NaturaLocal/muralla_torreVieja_es.mp3";

MediaPlayer mp = new MediaPlayer();
MediaController mc= new MediaController(mp);
mc.setDataSource(audiofile);
mc.prepare();
mc.start();
于 2013-02-27T22:12:58.523 回答