Merge branch 'dev' into dev

This commit is contained in:
Ajay Bura 2022-07-18 22:10:19 +05:30 committed by GitHub
commit db73ced9ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 5 deletions

View file

@ -15,15 +15,19 @@ import PlaySVG from '../../../../public/res/ic/outlined/play.svg';
import '../../i18n'; import '../../i18n';
// https://github.com/matrix-org/matrix-react-sdk/blob/a9e28db33058d1893d964ec96cd247ecc3d92fc3/src/utils/blobs.ts#L73 // https://github.com/matrix-org/matrix-react-sdk/blob/cd15e08fc285da42134817cce50de8011809cd53/src/utils/blobs.ts#L73
const ALLOWED_BLOB_MIMETYPES = [ const ALLOWED_BLOB_MIMETYPES = [
'image/jpeg', 'image/jpeg',
'image/gif', 'image/gif',
'image/png', 'image/png',
'image/apng',
'image/webp',
'image/avif',
'video/mp4', 'video/mp4',
'video/webm', 'video/webm',
'video/ogg', 'video/ogg',
'video/quicktime',
'audio/mp4', 'audio/mp4',
'audio/webm', 'audio/webm',
@ -41,6 +45,10 @@ function getBlobSafeMimeType(mimetype) {
if (!ALLOWED_BLOB_MIMETYPES.includes(mimetype)) { if (!ALLOWED_BLOB_MIMETYPES.includes(mimetype)) {
return 'application/octet-stream'; return 'application/octet-stream';
} }
// Required for Chromium browsers
if (mimetype === 'video/quicktime') {
return 'video/mp4';
}
return mimetype; return mimetype;
} }

View file

@ -51,9 +51,6 @@ function listenKeyboard(event) {
if (!event.ctrlKey && !event.altKey && !event.metaKey) { if (!event.ctrlKey && !event.altKey && !event.metaKey) {
if (navigation.isRawModalVisible) return; if (navigation.isRawModalVisible) return;
if (['input', 'textarea'].includes(document.activeElement.tagName.toLowerCase())) {
return;
}
if (event.code === 'Escape') { if (event.code === 'Escape') {
if (navigation.isRoomSettings) { if (navigation.isRoomSettings) {
@ -66,6 +63,10 @@ function listenKeyboard(event) {
} }
} }
if (['input', 'textarea'].includes(document.activeElement.tagName.toLowerCase())) {
return;
}
// focus the text field on most keypresses // focus the text field on most keypresses
if (shouldFocusMessageField(event.code)) { if (shouldFocusMessageField(event.code)) {
// press any key to focus and type in message field // press any key to focus and type in message field

View file

@ -46,7 +46,12 @@ function loadVideo(videoFile) {
reader.onerror = (e) => { reader.onerror = (e) => {
reject(e); reject(e);
}; };
reader.readAsDataURL(videoFile); if (videoFile.type === 'video/quicktime') {
const quicktimeVideoFile = new File([videoFile], videoFile.name, { type: 'video/mp4' });
reader.readAsDataURL(quicktimeVideoFile);
} else {
reader.readAsDataURL(videoFile);
}
}); });
} }
function getVideoThumbnail(video, width, height, mimeType) { function getVideoThumbnail(video, width, height, mimeType) {