mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-05 23:54:25 +00:00
feat(transcode): add 3D asset support and turntable viewer (#454)
* feat(transcode): add 3D asset support and turntable viewer * perf(turntable): stream file via Bun.file and increase upload timeout * feat(turntable): increase upload timeout to 15m to support 5GB uploads * fix(webui): align 3D model viewer layout and full-width control bar with video viewer * feat(webui): unify 3D viewer bottom bar and redesign cyclic ruler slider - Place RulerSlider in single row with playback and zoom controls, centered with max 320px width - Flank RulerSlider with minus and plus buttons to step angle by 15° - Redesign RulerSlider with fixed center indicator and moving cyclic track with continuous 360° wrapping - Render major ticks longer at 60° intervals without numeric text labels on track - Display floating degree tooltip above center indicator only during dragging * fix(webui): prevent RulerSlider from collapsing to 0px width in control bar - Use flex layout with flex-1 on left and right clusters to preserve center cluster width - Enforce min-w-[140px] and w-full on RulerSlider - Fix tooltip positioning and remove outer overflow-hidden * feat(webui): snap RulerSlider track directly to discrete 15° ticks during drag * fix(webui): prevent ruler snap-back caused by floating point second truncation - Use Math.round instead of Math.floor in secondToDegree to avoid 0.999996 dropping to previous frame - Ensure final dragDegree is committed on pointer up * fix(webui): fix arrow key frame rounding and duplicate event bubbling - Use Math.round instead of Math.floor for keyboard arrow frame navigation in ModelViewer - Add e.stopPropagation() to RulerSlider keyboard events to prevent duplicate bubbling to window listener * feat(webui): redesign RulerSlider with encapsulated step buttons and capsule pill track * feat(webui): make RulerSlider responsive on mobile and remove bottom bar reset button * fix(webui): load 3d video directly without poster and invert drag rotation to counterclockwise * fix(webui): fix 3d asset viewer frame seeking and drag jitter * feat(transcode): show 3D asset poster preview immediately after render start * fix(viewer): synchronize 3D turntable playback via frame callback to prevent skipped degrees * fix(viewer): handle touchpad zoom gestures and prevent page zoom in 3D viewer * fix(viewer): eliminate 3D model rotation jitter at 345 degrees * fix(share): watermark 3D asset turntable video on share links * fix(share): preserve video transcode resolution on watermarked share links * fix(viewer): download original 3D model file instead of rendered turntable MP4
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