jar 以上传到资源中
- <dependency>
- <groupId>it.sauronsoftwaregroupId>
- <artifactId>javeartifactId>
- <version>1.0.2version>
- dependency>
mvn install:install-file -Dfile=D:\xxx\xxx\jave-1.0.2.jar -DgroupId=it.sauronsoftware -DartifactId=java -Dversion=1.0.2 -Dpackaging=jar
获取音频时长
- /**
- * 音频文件获取文件时长(秒)
- * @param source
- * @return
- */
- public static Long getDuration(File source) {
- Encoder encoder = new Encoder();
- long ls = 0;
- MultimediaInfo m;
- try {
- m = encoder.getInfo(source);
- ls = m.getDuration()/1000;
- } catch (Exception e) {
- System.out.println("获取音频时长有误:" + e.getMessage());
- }
- return ls;
- }