diff --git a/projects/ucap-webmessenger-api-common/src/lib/services/common-api.service.ts b/projects/ucap-webmessenger-api-common/src/lib/services/common-api.service.ts index 099d8f9c..4ec66383 100644 --- a/projects/ucap-webmessenger-api-common/src/lib/services/common-api.service.ts +++ b/projects/ucap-webmessenger-api-common/src/lib/services/common-api.service.ts @@ -185,7 +185,7 @@ export class CommonApiService { public acceptableExtensionForFileTalk(extensions: string[]): boolean { for (const extension of extensions) { if ( - -1 === this.moduleConfig.acceptableFileExtensions.indexOf(extension) + -1 === this.moduleConfig.acceptableFileExtensions.indexOf(extension.toLowerCase()) ) { return false; } diff --git a/projects/ucap-webmessenger-core/src/lib/utils/file.util.ts b/projects/ucap-webmessenger-core/src/lib/utils/file.util.ts index 98f5cc07..387f3cef 100644 --- a/projects/ucap-webmessenger-core/src/lib/utils/file.util.ts +++ b/projects/ucap-webmessenger-core/src/lib/utils/file.util.ts @@ -80,8 +80,32 @@ export class FileUtil { const snapImage = () => new Promise((imgResolve, imgReject) => { const canvas = document.createElement('canvas'); - canvas.width = video.videoWidth; - canvas.height = video.videoHeight; + + // thumbnail image resize + const width = video.videoWidth; + const height = video.videoHeight; + let resizeWidth = 0; + let resizeHeight = 0; + + // max size + const maxWidth = 320; + const maxHeight = 320; + + if (width > maxWidth || height > maxHeight) { + if (width > height) { + resizeWidth = maxWidth; + resizeHeight = Math.round((height * resizeWidth) / width); + } else { + resizeHeight = maxHeight; + resizeWidth = Math.round((width * resizeHeight) / height); + } + } else { + resizeWidth = width; + resizeHeight = height; + } + + canvas.width = resizeWidth; + canvas.height = resizeHeight; canvas .getContext('2d') .drawImage(video, 0, 0, canvas.width, canvas.height); diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/video.component.html b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/video.component.html index ecc19459..4c61ae6e 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/video.component.html +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/video.component.html @@ -1,7 +1,9 @@
- +
+ +