Enable 300mb video uploads (#10497)

This commit is contained in:
Samuel Newman
2026-05-26 17:23:43 +03:00
committed by GitHub
parent 4eb692cf87
commit 1790fddc78
7 changed files with 49 additions and 17 deletions
+23 -6
View File
@@ -264,6 +264,7 @@ export async function processVideo(
did: string,
signal: AbortSignal,
i18n: I18n,
TEMP_enableLargeVideoUploads: boolean,
) {
let video: CompressedVideo | undefined
try {
@@ -272,9 +273,14 @@ export async function processVideo(
dispatch({type: 'update_progress', progress: trunc2dp(num), signal})
},
signal,
TEMP_enableLargeVideoUploads,
})
} catch (e) {
const message = getCompressErrorMessage(e, i18n)
const message = getCompressErrorMessage(
e,
i18n,
TEMP_enableLargeVideoUploads,
)
if (message !== null) {
dispatch({
type: 'to_error',
@@ -303,7 +309,7 @@ export async function processVideo(
},
})
} catch (e) {
const message = getUploadErrorMessage(e, i18n)
const message = getUploadErrorMessage(e, i18n, TEMP_enableLargeVideoUploads)
if (message !== null) {
dispatch({
type: 'to_error',
@@ -387,20 +393,30 @@ export async function processVideo(
}
}
function getCompressErrorMessage(e: unknown, i18n: I18n): string | null {
function getCompressErrorMessage(
e: unknown,
i18n: I18n,
TEMP_enableLargeVideoUploads: boolean,
): string | null {
const videoSize = TEMP_enableLargeVideoUploads ? 300 : 100
if (e instanceof AbortError) {
return null
}
if (e instanceof VideoTooLargeError) {
return i18n._(
msg`The selected video is larger than 100 MB. Please try again with a smaller file.`,
msg`The selected video is larger than ${videoSize} MB. Please try again with a smaller file.`,
)
}
logger.error('Error compressing video', {safeMessage: e})
return i18n._(msg`An error occurred while compressing the video.`)
}
function getUploadErrorMessage(e: unknown, i18n: I18n): string | null {
function getUploadErrorMessage(
e: unknown,
i18n: I18n,
TEMP_enableLargeVideoUploads: boolean,
): string | null {
const videoSize = TEMP_enableLargeVideoUploads ? 300 : 100
if (e instanceof AbortError) {
return null
}
@@ -430,8 +446,9 @@ function getUploadErrorMessage(e: unknown, i18n: I18n): string | null {
msg`Your account is not yet old enough to upload videos. Please try again later.`,
)
case 'file size (100000001 bytes) is larger than the maximum allowed size (100000000 bytes)':
case 'file size (300000001 bytes) is larger than the maximum allowed size (300000000 bytes)':
return i18n._(
msg`The selected video is larger than 100 MB. Please try again with a smaller file.`,
msg`The selected video is larger than ${videoSize} MB. Please try again with a smaller file.`,
)
case 'Confirm your email address to upload videos':
return i18n._(msg`Please confirm your email address to upload videos.`)