[Video] speculative .vtt file selection fix (#5296)
* speculative vtt fix * add loggingzio/stable^2^2
parent
ae71f5ce84
commit
7da3ddbe24
|
@ -3,6 +3,7 @@ import {View} from 'react-native'
|
|||
import {msg, Trans} from '@lingui/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
|
||||
import {logger} from '#/logger'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {atoms as a} from '#/alf'
|
||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||
|
@ -25,9 +26,16 @@ export function SubtitleFilePicker({
|
|||
const handlePick = (evt: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const selectedFile = evt.target.files?.[0]
|
||||
if (selectedFile) {
|
||||
if (selectedFile.type === 'text/vtt') {
|
||||
if (
|
||||
selectedFile.type === 'text/vtt' ||
|
||||
(selectedFile.type === 'text/plain' &&
|
||||
selectedFile.name.endsWith('.vtt'))
|
||||
) {
|
||||
onSelectFile(selectedFile)
|
||||
} else {
|
||||
logger.error('Invalid subtitle file type', {
|
||||
safeMessage: `File: ${selectedFile.name} (${selectedFile.type})`,
|
||||
})
|
||||
Toast.show(_(msg`Only WebVTT (.vtt) files are supported`))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue