public static void playMusic(Context context, String fileName){
if(mMediaPlayer == null){
mMediaPlayer = new MediaPlayer();
}
mMediaPlayer.reset();
AssetManager assetManager = context.getAssets();
try {
AssetFileDescriptor assetFileDescriptor = assetManager.openFd(fileName);
//设置数据源
mMediaPlayer.setDataSource(assetFileDescriptor.getFileDescriptor(),
assetFileDescriptor.getStartOffset(),
assetFileDescriptor.getLength());
mMediaPlayer.prepare();
mMediaPlayer.start();
} catch (IOException e) {
e.printStackTrace();
}
}