Compare commits

...

2 Commits

View File

@ -1143,16 +1143,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(";");