Merge branch 'dev' of https://github.com/Airyzz/cinny into dev

This commit is contained in:
Dylan 2022-08-06 17:09:19 +09:30
commit cf901fa1ad
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';
// 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 = [
'image/jpeg',
'image/gif',
'image/png',
'image/apng',
'image/webp',
'image/avif',
'video/mp4',
'video/webm',
'video/ogg',
'video/quicktime',
'audio/mp4',
'audio/webm',
@ -41,6 +45,10 @@ function getBlobSafeMimeType(mimetype) {
if (!ALLOWED_BLOB_MIMETYPES.includes(mimetype)) {
return 'application/octet-stream';
}
// Required for Chromium browsers
if (mimetype === 'video/quicktime') {
return 'video/mp4';
}
return mimetype;
}

View file

@ -51,9 +51,6 @@ function listenKeyboard(event) {
if (!event.ctrlKey && !event.altKey && !event.metaKey) {
if (navigation.isRawModalVisible) return;
if (['input', 'textarea'].includes(document.activeElement.tagName.toLowerCase())) {
return;
}
if (event.code === 'Escape') {
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
if (shouldFocusMessageField(event.code)) {
// press any key to focus and type in message field

View file

@ -46,7 +46,12 @@ function loadVideo(videoFile) {
reader.onerror = (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) {