styles and some housekeeping

This commit is contained in:
spencerwooo 2022-02-08 16:13:54 +08:00
parent 9faa2849eb
commit 331ee20fd6
No known key found for this signature in database
GPG key ID: 24CD550268849CA0

View file

@ -23,7 +23,11 @@ const VideoPreview: React.FC<{ file: OdFileObject }> = ({ file }) => {
const subtitle = `/api?path=${asPath.replace(getExtension(file.name), 'vtt')}&raw=true`
const isFlv = getExtension(file.name) === 'flv'
const { loading, error, result: flvjs } = useAsync(async () => {
const {
loading,
error,
result: flvjs,
} = useAsync(async () => {
if (isFlv) {
return (await import('flv.js')).default
}
@ -50,14 +54,14 @@ const VideoPreview: React.FC<{ file: OdFileObject }> = ({ file }) => {
customFlv: (video: HTMLVideoElement) => {
const flvPlayer = flvjs!.createPlayer({
type: 'flv',
url: video.src
url: video.src,
})
flvPlayer.attachMediaElement(video)
flvPlayer.load()
}
}
},
},
},
subtitle: { url: subtitle }
subtitle: { url: subtitle },
}}
/>
)}