80,350
社区成员
发帖
与我相关
我的任务
分享
public void startPlayback() {
stop();
mPlayer = new MediaPlayer();
try {
mPlayer.setDataSource(mSampleFile.getAbsolutePath());
mPlayer.setOnCompletionListener(this);
mPlayer.setOnErrorListener(this);
mPlayer.prepare();
mPlayer.start();
} catch (IllegalArgumentException e) {
setError(INTERNAL_ERROR);
mPlayer = null;
return;
} catch (IOException e) {
setError(SDCARD_ACCESS_ERROR);
mPlayer = null;
return;
}
mSampleStart = System.currentTimeMillis();
setState(PLAYING_STATE);
}