mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-02 05:54:44 +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:
@@ -258,6 +258,57 @@ describe('WatermarkService', () => {
|
||||
expect(mediaIds).toContain(mediaFile.id)
|
||||
})
|
||||
|
||||
it('should include 3D assets with turntable video in getMediaAssetIdsInShareLink', async () => {
|
||||
const user = await prisma.user.create({
|
||||
data: { name: '3D User', email: '3d-wm@example.com' },
|
||||
})
|
||||
const team = await teamService.createTeam(user, { name: '3D Team' })
|
||||
|
||||
const projectFolder = await prisma.asset.create({
|
||||
data: { name: 'root', type: 'root', status: 'processed' },
|
||||
})
|
||||
const project = await prisma.project.create({
|
||||
data: { name: '3D Project', teamId: team.id, rootFolderId: projectFolder.id },
|
||||
})
|
||||
|
||||
const shareLink = await shareService.createShareLink(project.id, { name: '3D Share' }, user.id)
|
||||
|
||||
const modelAsset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'robot.glb',
|
||||
type: 'file',
|
||||
mediaType: 'model/gltf-binary',
|
||||
status: 'processed',
|
||||
projectId: project.id,
|
||||
media: {
|
||||
duration: 4,
|
||||
filesize: 100,
|
||||
frames: 24,
|
||||
proxyType: '3d',
|
||||
videoTranscodes: [
|
||||
{ key: 'files/asset-3d/turntable.mp4', width: 1080, height: 1080, resolution: '1080p' },
|
||||
],
|
||||
finishedAt: new Date().toISOString(),
|
||||
original: { key: 'files/asset-3d/robot.glb', filesizeInBytes: 100, codec: '' },
|
||||
} as PrismaJson.MediaInfo,
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.asset.create({
|
||||
data: {
|
||||
name: 'robot.glb',
|
||||
type: 'symlink',
|
||||
status: 'processed',
|
||||
projectId: project.id,
|
||||
parentId: shareLink.rootFolderId,
|
||||
targetId: modelAsset.id,
|
||||
},
|
||||
})
|
||||
|
||||
const mediaIds = await watermarkService.getMediaAssetIdsInShareLink(shareLink.rootFolderId)
|
||||
expect(mediaIds).toContain(modelAsset.id)
|
||||
})
|
||||
|
||||
describe('purgeOrphanWatermarkConfigs', () => {
|
||||
const bucket = 'shumai-gc-test-bucket'
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
} from '@shumai/core/src/share/errors'
|
||||
import { shareService } from '@shumai/core/src/share/share'
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import { is3dModel } from '@shumai/core/src/utils/mime'
|
||||
|
||||
// Union of the global client and interactive-transaction client, which share the
|
||||
// same delegate shapes for the models used by this service.
|
||||
@@ -319,8 +320,9 @@ export class WatermarkService {
|
||||
const proxyType = mediaInfo?.proxyType
|
||||
const isVideo = proxyType === 'video' || asset.mediaType?.startsWith('video/')
|
||||
const isImage = proxyType === 'image' || asset.mediaType?.startsWith('image/')
|
||||
const is3d = proxyType === '3d' || is3dModel(asset.mediaType)
|
||||
|
||||
if (isVideo || isImage) {
|
||||
if (isVideo || isImage || is3d) {
|
||||
mediaAssetIds.push(asset.id)
|
||||
}
|
||||
} else if (asset.type === 'folder' || asset.type === 'version_stack') {
|
||||
|
||||
Reference in New Issue
Block a user