优化
This commit is contained in:
@@ -251,7 +251,7 @@ public class TikUserFileServiceImpl implements TikUserFileService {
|
||||
vo.setIsVideo(isVideo);
|
||||
vo.setIsImage(isImage);
|
||||
|
||||
// 视频文件:使用 OSS 截帧
|
||||
// 视频文件:使用 OSS 截帧作为封面
|
||||
if (isVideo) {
|
||||
// 使用 OSS 视频截帧作为封面(预签名时包含截帧参数,避免 403)
|
||||
// t_1000: 截取1秒处(避免开头黑屏/非关键帧)
|
||||
@@ -262,7 +262,7 @@ public class TikUserFileServiceImpl implements TikUserFileService {
|
||||
file.getFileUrl(),
|
||||
PRESIGN_URL_EXPIRATION_SECONDS,
|
||||
"video/snapshot,t_1000,f_jpg,w_300");
|
||||
vo.setPreviewUrl(snapshotUrl);
|
||||
vo.setImgUrl(snapshotUrl);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
@@ -273,8 +273,8 @@ public class TikUserFileServiceImpl implements TikUserFileService {
|
||||
: null;
|
||||
vo.setThumbnailUrl(thumbnailUrl);
|
||||
|
||||
// 图片预览URL:优先缩略图,否则原图
|
||||
vo.setPreviewUrl(isImage
|
||||
// 图片封面URL:优先缩略图,否则原图
|
||||
vo.setImgUrl(isImage
|
||||
? (thumbnailUrl != null ? thumbnailUrl : getCachedPresignUrl(file.getFileUrl(), PRESIGN_URL_EXPIRATION_SECONDS))
|
||||
: null);
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ public class AppTikUserFileRespVO {
|
||||
@Schema(description = "文件访问URL", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String fileUrl;
|
||||
|
||||
@Schema(description = "预览URL(视频返回封面,图片返回缩略图)")
|
||||
private String previewUrl;
|
||||
@Schema(description = "封面图URL(视频返回截帧,图片返回缩略图)")
|
||||
private String imgUrl;
|
||||
|
||||
@Schema(description = "是否为视频文件", example = "true")
|
||||
private Boolean isVideo;
|
||||
|
||||
Reference in New Issue
Block a user