1
0

2 Commitit 9222d96920 ... d3fb80b920

Tekijä SHA1 Viesti Päivämäärä
  wjx d3fb80b920 Merge branch 'develop' of http://git.zanxiangnet.com/wjx/ad-manage 2 viikkoa sitten
  wjx 23944f9d98 fix 2 viikkoa sitten

+ 16 - 10
src/pages/launchSystemV3/material/cloudNew/uploadFile.tsx

@@ -117,16 +117,22 @@ const UploadFile: React.FC<Props> = ({ visible, onClose, folderId, userId, onCha
                 height = imgData.height
             } else if (queryForm.materialType === "video") {
                 const videoInfo: { width: number, height: number, videoLength: number }[] = await videoMessage([file])
-                const readChunk = async (chunkSize: number, offset: number) => new Uint8Array(await file.slice(offset, offset + chunkSize).arrayBuffer());
-                // @ts-ignore
-                const mediaInfo = await MediaInfo.mediaInfoFactory({ format: 'object' })
-                const result = await mediaInfo.analyzeData(file.size, readChunk)
-                if (result?.media?.track) {
-                    const { Height, Width, Duration } = result?.media?.track.find((item: { [x: string]: string }) => item['@type'] === 'Video')
-                    width = Width
-                    height = Height
-                    videoDuration = Duration
-                } else {
+                try {
+                    const readChunk = async (chunkSize: number, offset: number) => new Uint8Array(await file.slice(offset, offset + chunkSize).arrayBuffer());
+                    // @ts-ignore
+                    const mediaInfo = await MediaInfo.mediaInfoFactory({ format: 'object' })
+                    const result = await mediaInfo.analyzeData(file.size, readChunk)
+                    if (result?.media?.track) {
+                        const { Height, Width, Duration } = result?.media?.track.find((item: { [x: string]: string }) => item['@type'] === 'Video')
+                        width = Width
+                        height = Height
+                        videoDuration = Duration
+                    } else {
+                        width = videoInfo[0].width
+                        height = videoInfo[0].height
+                        videoDuration = videoInfo[0].videoLength
+                    }
+                } catch (error) {
                     width = videoInfo[0].width
                     height = videoInfo[0].height
                     videoDuration = videoInfo[0].videoLength

+ 16 - 10
src/pages/launchSystemV3/material/cloudNew/uploadsTable.tsx

@@ -141,16 +141,22 @@ const UploadsTable: React.FC<Props> = ({ isPermission, fileList, visible, onClos
                 height = imgData.height
             } else if (file.type.startsWith('video/')) {
                 const videoInfo: { width: number, height: number, videoLength: number }[] = await videoMessage([file as any])
-                const readChunk = async (chunkSize: number, offset: number) => new Uint8Array(await file.slice(offset, offset + chunkSize).arrayBuffer());
-                // @ts-ignore
-                const mediaInfo = await MediaInfo.mediaInfoFactory({ format: 'object' })
-                const result = await mediaInfo.analyzeData(file.size, readChunk)
-                if (result?.media?.track) {
-                    const { Height, Width, Duration } = result?.media?.track.find((item: { [x: string]: string }) => item['@type'] === 'Video')
-                    width = Width
-                    height = Height
-                    videoDuration = Duration
-                } else {
+                try {
+                    const readChunk = async (chunkSize: number, offset: number) => new Uint8Array(await file.slice(offset, offset + chunkSize).arrayBuffer());
+                    // @ts-ignore
+                    const mediaInfo = await MediaInfo.mediaInfoFactory({ format: 'object' })
+                    const result = await mediaInfo.analyzeData(file.size, readChunk)
+                    if (result?.media?.track) {
+                        const { Height, Width, Duration } = result?.media?.track.find((item: { [x: string]: string }) => item['@type'] === 'Video')
+                        width = Width
+                        height = Height
+                        videoDuration = Duration
+                    } else {
+                        width = videoInfo[0].width
+                        height = videoInfo[0].height
+                        videoDuration = videoInfo[0].videoLength
+                    }
+                } catch (error) {
                     width = videoInfo[0].width
                     height = videoInfo[0].height
                     videoDuration = videoInfo[0].videoLength