fallback to fixed size when video has no size info
This commit is contained in:
@@ -53,6 +53,9 @@ export const MAX_AVATAR_BYTES = 4096;
|
|||||||
// Size of the broken_image shown in MessagesView
|
// Size of the broken_image shown in MessagesView
|
||||||
export const BROKEN_IMAGE_SIZE = 32;
|
export const BROKEN_IMAGE_SIZE = 32;
|
||||||
|
|
||||||
|
// Size of video preview when dimensions are missing.
|
||||||
|
export const NO_DIMENSIONS_VIDEO = 128;
|
||||||
|
|
||||||
// Number of chat messages to fetch in one call.
|
// Number of chat messages to fetch in one call.
|
||||||
export const MESSAGES_PAGE = 24;
|
export const MESSAGES_PAGE = 24;
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import InlineVideo from '../widgets/inline-video.jsx';
|
|||||||
import LazyImage from '../widgets/lazy-image.jsx'
|
import LazyImage from '../widgets/lazy-image.jsx'
|
||||||
import UploadingImage from '../widgets/uploading-image.jsx'
|
import UploadingImage from '../widgets/uploading-image.jsx'
|
||||||
|
|
||||||
import { BROKEN_IMAGE_SIZE, IMAGE_THUMBNAIL_DIM, REM_SIZE, VIDEO_THUMBNAIL_WIDTH } from '../config.js';
|
import { BROKEN_IMAGE_SIZE, IMAGE_THUMBNAIL_DIM, NO_DIMENSIONS_VIDEO, REM_SIZE, VIDEO_THUMBNAIL_WIDTH } from '../config.js';
|
||||||
import { base64ToBlob, blobToBase64, fitImageSize, imageScaled } from './blob-helpers.js';
|
import { base64ToBlob, blobToBase64, fitImageSize, imageScaled } from './blob-helpers.js';
|
||||||
import { idToColorClass, secondsToTime, shortenFileName } from './strformat.js';
|
import { idToColorClass, secondsToTime, shortenFileName } from './strformat.js';
|
||||||
import { cancelablePromise, sanitizeUrlForMime } from './utils.js';
|
import { cancelablePromise, sanitizeUrlForMime } from './utils.js';
|
||||||
@@ -222,7 +222,7 @@ function handleVideoData(el, data, attr) {
|
|||||||
const dim = fitImageSize(data.width, data.height,
|
const dim = fitImageSize(data.width, data.height,
|
||||||
this.viewportWidth > 0 ? Math.min(this.viewportWidth - REM_SIZE * 6.5, REM_SIZE * 34.5) :
|
this.viewportWidth > 0 ? Math.min(this.viewportWidth - REM_SIZE * 6.5, REM_SIZE * 34.5) :
|
||||||
REM_SIZE * 34.5, REM_SIZE * 24, false) ||
|
REM_SIZE * 34.5, REM_SIZE * 24, false) ||
|
||||||
{dstWidth: BROKEN_IMAGE_SIZE, dstHeight: BROKEN_IMAGE_SIZE};
|
{dstWidth: NO_DIMENSIONS_VIDEO, dstHeight: NO_DIMENSIONS_VIDEO};
|
||||||
attr.style = {
|
attr.style = {
|
||||||
width: dim.dstWidth + 'px',
|
width: dim.dstWidth + 'px',
|
||||||
height: dim.dstHeight + 'px',
|
height: dim.dstHeight + 'px',
|
||||||
|
|||||||
+4
-2
@@ -2195,6 +2195,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony export */ "MIN_TAG_LENGTH": () => (/* binding */ MIN_TAG_LENGTH),
|
/* harmony export */ "MIN_TAG_LENGTH": () => (/* binding */ MIN_TAG_LENGTH),
|
||||||
/* harmony export */ "NEW_GRP_ACCESS_MODE": () => (/* binding */ NEW_GRP_ACCESS_MODE),
|
/* harmony export */ "NEW_GRP_ACCESS_MODE": () => (/* binding */ NEW_GRP_ACCESS_MODE),
|
||||||
/* harmony export */ "NO_ACCESS_MODE": () => (/* binding */ NO_ACCESS_MODE),
|
/* harmony export */ "NO_ACCESS_MODE": () => (/* binding */ NO_ACCESS_MODE),
|
||||||
|
/* harmony export */ "NO_DIMENSIONS_VIDEO": () => (/* binding */ NO_DIMENSIONS_VIDEO),
|
||||||
/* harmony export */ "QUOTED_REPLY_LENGTH": () => (/* binding */ QUOTED_REPLY_LENGTH),
|
/* harmony export */ "QUOTED_REPLY_LENGTH": () => (/* binding */ QUOTED_REPLY_LENGTH),
|
||||||
/* harmony export */ "READ_DELAY": () => (/* binding */ READ_DELAY),
|
/* harmony export */ "READ_DELAY": () => (/* binding */ READ_DELAY),
|
||||||
/* harmony export */ "REM_SIZE": () => (/* binding */ REM_SIZE),
|
/* harmony export */ "REM_SIZE": () => (/* binding */ REM_SIZE),
|
||||||
@@ -2225,6 +2226,7 @@ const REM_SIZE = 13;
|
|||||||
const AVATAR_SIZE = 384;
|
const AVATAR_SIZE = 384;
|
||||||
const MAX_AVATAR_BYTES = 4096;
|
const MAX_AVATAR_BYTES = 4096;
|
||||||
const BROKEN_IMAGE_SIZE = 32;
|
const BROKEN_IMAGE_SIZE = 32;
|
||||||
|
const NO_DIMENSIONS_VIDEO = 128;
|
||||||
const MESSAGES_PAGE = 24;
|
const MESSAGES_PAGE = 24;
|
||||||
const MAX_INBAND_ATTACHMENT_SIZE = 262_144;
|
const MAX_INBAND_ATTACHMENT_SIZE = 262_144;
|
||||||
const MAX_EXTERN_ATTACHMENT_SIZE = 1 << 23;
|
const MAX_EXTERN_ATTACHMENT_SIZE = 1 << 23;
|
||||||
@@ -2780,8 +2782,8 @@ function handleVideoData(el, data, attr) {
|
|||||||
}
|
}
|
||||||
attr.className = 'inline-image';
|
attr.className = 'inline-image';
|
||||||
const dim = (0,_blob_helpers_js__WEBPACK_IMPORTED_MODULE_10__.fitImageSize)(data.width, data.height, this.viewportWidth > 0 ? Math.min(this.viewportWidth - _config_js__WEBPACK_IMPORTED_MODULE_9__.REM_SIZE * 6.5, _config_js__WEBPACK_IMPORTED_MODULE_9__.REM_SIZE * 34.5) : _config_js__WEBPACK_IMPORTED_MODULE_9__.REM_SIZE * 34.5, _config_js__WEBPACK_IMPORTED_MODULE_9__.REM_SIZE * 24, false) || {
|
const dim = (0,_blob_helpers_js__WEBPACK_IMPORTED_MODULE_10__.fitImageSize)(data.width, data.height, this.viewportWidth > 0 ? Math.min(this.viewportWidth - _config_js__WEBPACK_IMPORTED_MODULE_9__.REM_SIZE * 6.5, _config_js__WEBPACK_IMPORTED_MODULE_9__.REM_SIZE * 34.5) : _config_js__WEBPACK_IMPORTED_MODULE_9__.REM_SIZE * 34.5, _config_js__WEBPACK_IMPORTED_MODULE_9__.REM_SIZE * 24, false) || {
|
||||||
dstWidth: _config_js__WEBPACK_IMPORTED_MODULE_9__.BROKEN_IMAGE_SIZE,
|
dstWidth: _config_js__WEBPACK_IMPORTED_MODULE_9__.NO_DIMENSIONS_VIDEO,
|
||||||
dstHeight: _config_js__WEBPACK_IMPORTED_MODULE_9__.BROKEN_IMAGE_SIZE
|
dstHeight: _config_js__WEBPACK_IMPORTED_MODULE_9__.NO_DIMENSIONS_VIDEO
|
||||||
};
|
};
|
||||||
attr.style = {
|
attr.style = {
|
||||||
width: dim.dstWidth + 'px',
|
width: dim.dstWidth + 'px',
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user