mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 20:06:51 +08:00
视频上传添加视频时长
This commit is contained in:
@@ -14,6 +14,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.xboe.core.SysConstant;
|
import com.xboe.core.SysConstant;
|
||||||
import com.xboe.standard.BaseConstant;
|
import com.xboe.standard.BaseConstant;
|
||||||
|
import com.xboe.system.assist.entity.XUploadResultDto;
|
||||||
import it.sauronsoftware.jave.Encoder;
|
import it.sauronsoftware.jave.Encoder;
|
||||||
import it.sauronsoftware.jave.MultimediaInfo;
|
import it.sauronsoftware.jave.MultimediaInfo;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -117,7 +118,13 @@ public class SysUploaderApi extends ApiBaseController{
|
|||||||
// ex.printStackTrace();
|
// ex.printStackTrace();
|
||||||
log.error("处理失败",ex);
|
log.error("处理失败",ex);
|
||||||
}
|
}
|
||||||
return wrap(xur);
|
XUploadResultDto dto=new XUploadResultDto();
|
||||||
|
String fileFullPath = SysConstant.getConfigValue(BaseConstant.CONFIG_UPLOAD_FILES_SAVEPATH) + xur.getFilePath();
|
||||||
|
Encoder encoder = new Encoder();
|
||||||
|
MultimediaInfo m = encoder.getInfo(new File(fileFullPath));
|
||||||
|
Long ls = m.getDuration() / 1000;//秒
|
||||||
|
dto.setDuration(ls);
|
||||||
|
return wrap(dto);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("upload file error ",e);
|
log.error("upload file error ",e);
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.xboe.system.assist.entity;
|
||||||
|
|
||||||
|
import com.xboe.core.upload.XUploadResult;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class XUploadResultDto extends XUploadResult {
|
||||||
|
private Long duration;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user