我正在创建一个媒体播放器。但是当我按下按钮(播放)时,它显示错误。
08-20 11:35:21.473: D/MediaPlayer(775): Couldn't open file on client side, trying server side
08-20 11:35:21.493: E/MediaPlayer(775): error (1, -2147483648)
08-20 11:35:21.503: W/System.err(775): java.io.IOException: Prepare failed.: status=0x1
我的代码是
btnplay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri audio = Uri.parse("android.resourse://vishesh.MediaPlayer/res/drawable/jannat");
try {
mp.setDataSource(Play.this,audio);
mp.prepare();
mp.start();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
btnplay.setText("Pause");
}
});