java獲取音訊時長

zhe哲發表於2018-01-03
/**
     * 獲取音訊時長
     * @param fis
     * @throws IOException
     * @throws BitstreamException	
     */
    public static String getAudioPlayTime(File source){
         Encoder encoder = new Encoder();
         long ls = 0;
         try {
             MultimediaInfo m = encoder.getInfo(source);
             ls = m.getDuration();
         } catch (Exception e) {
             e.printStackTrace();
         }
         
         return ls / 60000 + "分" + ls / 1000 + "秒!";
    }

相關文章