mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-04 15:14:10 +00:00
fix(webui): fix 3d asset viewer frame seeking and drag jitter
This commit is contained in:
@@ -192,3 +192,38 @@ export const sampleAudioAsset: AssetInfo = {
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export const TURNTABLE_VIDEO_URL = '/turntable.mp4'
|
||||
export const TURNTABLE_FRAME_RATE = 6
|
||||
export const TURNTABLE_TOTAL_FRAMES = 24
|
||||
export const TURNTABLE_DURATION = 4.0
|
||||
export const TURNTABLE_WIDTH = 1080
|
||||
export const TURNTABLE_HEIGHT = 1080
|
||||
|
||||
export const sampleTurntableAsset: AssetInfo = {
|
||||
id: 'e2e-turntable-asset',
|
||||
name: 'turntable.glb',
|
||||
proxyType: '3d',
|
||||
type: 'file',
|
||||
status: 'ready',
|
||||
sizeByte: 314488,
|
||||
fileCount: 1,
|
||||
createdAt: '2026-01-01T00:00:00.000Z',
|
||||
updatedAt: '2026-01-01T00:00:00.000Z',
|
||||
media: {
|
||||
proxyType: '3d',
|
||||
videoPreview: {
|
||||
url: TURNTABLE_VIDEO_URL,
|
||||
},
|
||||
original: {
|
||||
key: 'turntable.glb',
|
||||
},
|
||||
metadata: {
|
||||
duration: TURNTABLE_DURATION,
|
||||
originalWidth: TURNTABLE_WIDTH,
|
||||
originalHeight: TURNTABLE_HEIGHT,
|
||||
frameRate: TURNTABLE_FRAME_RATE,
|
||||
totalFrames: TURNTABLE_TOTAL_FRAMES,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { type ReactElement, useCallback, useRef, useState } from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import type { MediaController } from '@/ui/components/viewers/types'
|
||||
import VideoPlayer from '@/ui/components/viewers/video/video-viewer'
|
||||
import ModelViewer from '@/ui/components/viewers/model/model-viewer'
|
||||
import { calculateFrameCenterTime } from '@/ui/components/viewers/video/utils'
|
||||
import { useUiStore } from '@/ui/stores/ui'
|
||||
import {
|
||||
@@ -10,6 +11,7 @@ import {
|
||||
containerLongerVideoAsset,
|
||||
longAudioVideoAsset,
|
||||
sampleAudioAsset,
|
||||
sampleTurntableAsset,
|
||||
} from './fixture'
|
||||
|
||||
/**
|
||||
@@ -60,6 +62,7 @@ function resolveAsset() {
|
||||
if (variant === 'container-longer') return containerLongerVideoAsset
|
||||
if (variant === 'long-audio') return longAudioVideoAsset
|
||||
if (variant === 'audio') return sampleAudioAsset
|
||||
if (variant === '3d' || variant === 'turntable') return sampleTurntableAsset
|
||||
return sampleVideoAsset
|
||||
}
|
||||
|
||||
@@ -132,12 +135,21 @@ function Harness(): ReactElement {
|
||||
style={{ width: '800px', height: '600px', display: 'flex', overflow: 'hidden' }}
|
||||
>
|
||||
<div className="flex flex-col flex-1 h-full overflow-hidden relative">
|
||||
<VideoPlayer
|
||||
key={playerKey}
|
||||
file={harnessAsset}
|
||||
ref={playerRef}
|
||||
onTimeUpdate={handleTimeUpdate}
|
||||
/>
|
||||
{harnessAsset.proxyType === '3d' ? (
|
||||
<ModelViewer
|
||||
key={playerKey}
|
||||
file={harnessAsset}
|
||||
ref={playerRef}
|
||||
onTimeUpdate={handleTimeUpdate}
|
||||
/>
|
||||
) : (
|
||||
<VideoPlayer
|
||||
key={playerKey}
|
||||
file={harnessAsset}
|
||||
ref={playerRef}
|
||||
onTimeUpdate={handleTimeUpdate}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -34,6 +34,10 @@ const server = Bun.serve({
|
||||
new Response(Bun.file(join(fixturesDir, 'sample-audio.mp4')), {
|
||||
headers: { 'Content-Type': 'video/mp4' },
|
||||
}),
|
||||
'/turntable.mp4': () =>
|
||||
new Response(Bun.file(join(fixturesDir, 'turntable.mp4')), {
|
||||
headers: { 'Content-Type': 'video/mp4' },
|
||||
}),
|
||||
'/': index,
|
||||
'/*': index,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user