mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-26 06:00:12 +00:00
fix(transcode): match target long sides exactly and dynamic resolution mapping
This commit is contained in:
@@ -376,10 +376,21 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
|
||||
resolution: 'Original',
|
||||
} as DisplayTranscode
|
||||
|
||||
const resolutions: DisplayTranscode[] = (data.media.videoTranscodes ?? []).map((t) => ({
|
||||
...t,
|
||||
resolution: t.isRaw ? 'Original' : `${t.height}p`,
|
||||
}))
|
||||
const resolutions: DisplayTranscode[] = (data.media.videoTranscodes ?? []).map((t) => {
|
||||
const longSide = Math.max(t.width, t.height)
|
||||
let resolution = `${t.height}p`
|
||||
if (longSide >= 3840) resolution = '2160p'
|
||||
else if (longSide >= 1920) resolution = '1080p'
|
||||
else if (longSide >= 1280) resolution = '720p'
|
||||
else if (longSide >= 960) resolution = '540p'
|
||||
else if (longSide >= 640) resolution = '360p'
|
||||
else if (longSide >= 320) resolution = '180p'
|
||||
|
||||
return {
|
||||
...t,
|
||||
resolution: t.isRaw ? 'Original' : resolution,
|
||||
}
|
||||
})
|
||||
|
||||
const previewResolutions = resolutions.filter((r) => !r.isRaw)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user