fix: ignore transcoding for some videos (#9354)

This commit is contained in:
Alexander Onnikov
2025-06-24 21:23:25 +07:00
committed by GitHub
parent 6503e735f4
commit d900cc5d01
3 changed files with 14 additions and 5 deletions
+1 -1
View File
@@ -1 +1 @@
stream hardcoreeng/service_stream:0.4.0
stream hardcoreeng/service_stream:0.4.5
+12 -3
View File
@@ -17,6 +17,15 @@ import core, { type Blob, type Doc, type MeasureContext, type TxCUD, type TxCrea
import { PlatformQueueProducer } from '@hcengineering/server-core'
import { VideoTranscodeRequest, VideoTranscodeResult } from './types'
const transcodeIgnoredContentTypes = [
'video/x-mpegurl', // HLS playlist
'video/mp2t' // MPEG-2 Transport Stream
]
function shouldTranscode (contentType: string): boolean {
return contentType.startsWith('video/') && !transcodeIgnoredContentTypes.includes(contentType)
}
export async function handleTx (
ctx: MeasureContext,
workspaceUuid: string,
@@ -27,15 +36,15 @@ export async function handleTx (
if (tx._class !== core.class.TxCreateDoc) return
const createTx = tx as TxCreateDoc<Blob>
if (createTx.attributes.contentType.startsWith('video/')) {
if (shouldTranscode(createTx.attributes.contentType)) {
const msg: VideoTranscodeRequest = {
workspaceUuid,
blobId: createTx.objectId,
contentType: createTx.attributes.contentType
}
ctx.info('Transcode request', { msg })
await producer.send(createTx.objectId, [msg])
ctx.info('Transcode request', { workspaceUuid, msg })
await producer.send(workspaceUuid, [msg])
}
}
+1 -1
View File
@@ -24,5 +24,5 @@ export interface VideoTranscodeResult {
workspaceUuid: string
thumbnail?: string
hls?: string
playlist?: string
}