contentoh-components-library 21.4.138 → 21.4.139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -195,37 +195,49 @@ export const RetailerProductEdition = ({
|
|
|
195
195
|
noClick: true,
|
|
196
196
|
onDrop: (acceptedFiles) => {
|
|
197
197
|
const newImages = [];
|
|
198
|
-
var createThumbnail = true;
|
|
199
198
|
acceptedFiles.map((file) => {
|
|
200
199
|
const reader = new FileReader();
|
|
201
200
|
reader.fileName = file.name;
|
|
202
|
-
|
|
203
201
|
reader.onload = async function (e) {
|
|
204
202
|
const ext = e.srcElement.fileName.split(".");
|
|
205
203
|
const img = new Image();
|
|
206
|
-
if(ext[ext.length - 1]=="mp4"){
|
|
207
|
-
img.src= await generateThumbnail(e.target.result, 2);
|
|
204
|
+
if (ext[ext.length - 1] == "mp4") {
|
|
208
205
|
obtenerDuracionVideoBase64(e.target.result)
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
206
|
+
.then(async (duracion) => {
|
|
207
|
+
if (duracion > 15 && duracion < 300) {
|
|
208
|
+
img.src = await generateThumbnail(e.target.result, 2);
|
|
209
|
+
setTimeout(() => {
|
|
210
|
+
const width = img.width;
|
|
211
|
+
const height = img.height;
|
|
212
|
+
const newImg = {
|
|
213
|
+
action: "addImg",
|
|
214
|
+
img: {
|
|
215
|
+
src: img.src, //e.target.result,
|
|
216
|
+
name: e.target.fileName,
|
|
217
|
+
ext: ext[ext.length - 1],
|
|
218
|
+
width: width,
|
|
219
|
+
height: height,
|
|
220
|
+
video_src:
|
|
221
|
+
ext[ext.length - 1] == "mp4" ? e.target.result : "",
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
setImages(newImg);
|
|
225
|
+
}, 500);
|
|
226
|
+
} else {
|
|
227
|
+
setModalAlert({
|
|
228
|
+
show: true,
|
|
229
|
+
title: "Hay un error al subir el video",
|
|
230
|
+
message:
|
|
231
|
+
"Los videos deben durar entre 15 segundos y 5 minutos",
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
.catch((error) => {
|
|
236
|
+
console.error("Error al obtener la duración del video:", error);
|
|
237
|
+
});
|
|
238
|
+
} else {
|
|
225
239
|
img.src = e.target.result;
|
|
226
|
-
|
|
227
|
-
if(createThumbnail){
|
|
228
|
-
generasetTimeout(() => {
|
|
240
|
+
setTimeout(() => {
|
|
229
241
|
const width = img.width;
|
|
230
242
|
const height = img.height;
|
|
231
243
|
const newImg = {
|
|
@@ -236,7 +248,8 @@ export const RetailerProductEdition = ({
|
|
|
236
248
|
ext: ext[ext.length - 1],
|
|
237
249
|
width: width,
|
|
238
250
|
height: height,
|
|
239
|
-
video_src:
|
|
251
|
+
video_src:
|
|
252
|
+
ext[ext.length - 1] == "mp4" ? e.target.result : "",
|
|
240
253
|
},
|
|
241
254
|
};
|
|
242
255
|
setImages(newImg);
|