code: public static void playSound(String fileName, long offset, long length,
                                   boolean sync) {
  
          FileInputStream fis = null;
          try {
              if (player == null) {
                  player = new MediaPlayer();
              }
  
              player.reset();
              fis = new FileInputStream(fileName);
              int available = fis.available();
  
              if (available < offset)
                  return;
  
              if (length == -1 || length + offset > available) {
                  length = available - offset;
              }
  
              player.setDataSource(fis.getFD(), offset, length);
              player.prepare();
              player.start();
  
              if (sync) {
                  while (player.isPlaying()) {
                      Thread.sleep(30);
                  }
              }
  
          } catch (Exception e) {
              Log.e(TAG, "", e);
          } finally {
              if (fis != null) {
                  try {
                      fis.close();
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
          }
  
      }
docs: 播放文件中的部分音频
  
  @param fileName
  @param offset
  @param length   -1 means play all.
  @param sync     是否同步播放, 如果同步播放则会等到播放结束时再返回, 反之则调用之后就直接返回