我目前有一个播放mp3的媒体播放器,完成后应转到下一个网址。但是,它没有播放。难道我做错了什么?我原来在字符串数组中有url但是改变它仍然不起作用。它超时,力量关闭。
代码:
try {
houseMediaPlayer.setDataSource(housePlaylistString[0]);
houseMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
houseMediaPlayer.prepare();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
`houseMediaPlayer.setOnCompletionListener(new OnCompletionListener(){
@Override
public void onCompletion(MediaPlayer mp) {
// TODO Auto-generated method stub
try {
houseMediaPlayer.setDataSource("http://dl.dropbox.com/u/24535120/Reminded%20-%20Tyga%20ft.%20Adele.mp3");
houseMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
houseMediaPlayer.prepare();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
houseMediaPlayer.start();
}
});`