6155解决 iOS 上的分辨率检查问题
This commit is contained in:
@ -1136,16 +1136,19 @@
|
||||
success: function(res) {
|
||||
console.log("res=",res);
|
||||
let path = res.tempFilePath;
|
||||
let width = res.width;
|
||||
let height = res.height;
|
||||
// iOS可能返回浮点数,需要转换为整数进行比较
|
||||
let width = Math.round(res.width);
|
||||
let height = Math.round(res.height);
|
||||
let duration = res.duration;
|
||||
console.log("视频信息 - 宽度:", width, "高度:", height, "时长:", duration);
|
||||
let err = [];
|
||||
if (duration < 2) {
|
||||
err.push("视频时长至少2秒");
|
||||
}
|
||||
|
||||
if (width != 160 || height != 80) {
|
||||
err.push("视频宽高必须是160*80");
|
||||
// 使用容差比较,允许1像素的误差(iOS可能有精度问题)
|
||||
if (Math.abs(width - 160) > 1 || Math.abs(height - 80) > 1) {
|
||||
err.push("视频宽高必须是160*80,当前分辨率:" + width + "*" + height);
|
||||
}
|
||||
if (err.length > 0) {
|
||||
err = err.join(";");
|
||||
|
||||
Reference in New Issue
Block a user