🎨chore: 使用 oxlint, oxfmt&格式化代码
This commit is contained in:
@@ -3,28 +3,28 @@ import {
|
||||
EmbedSubtitlesClip,
|
||||
MP4Clip,
|
||||
OffscreenSprite,
|
||||
} from "@webav/av-cliper";
|
||||
} from '@webav/av-cliper'
|
||||
|
||||
export interface SubtitleEmbeddingOptions {
|
||||
color?: string;
|
||||
textBgColor?: string | null;
|
||||
type?: "srt";
|
||||
fontFamily?: string;
|
||||
fontSize?: number;
|
||||
letterSpacing?: string | null;
|
||||
bottomOffset?: number;
|
||||
strokeStyle?: string;
|
||||
lineWidth?: number | null;
|
||||
lineCap?: CanvasLineCap | null;
|
||||
lineJoin?: CanvasLineJoin | null;
|
||||
color?: string
|
||||
textBgColor?: string | null
|
||||
type?: 'srt'
|
||||
fontFamily?: string
|
||||
fontSize?: number
|
||||
letterSpacing?: string | null
|
||||
bottomOffset?: number
|
||||
strokeStyle?: string
|
||||
lineWidth?: number | null
|
||||
lineCap?: CanvasLineCap | null
|
||||
lineJoin?: CanvasLineJoin | null
|
||||
textShadow?: {
|
||||
offsetX: number;
|
||||
offsetY: number;
|
||||
blur: number;
|
||||
color: string;
|
||||
};
|
||||
videoWidth?: number;
|
||||
videoHeight?: number;
|
||||
offsetX: number
|
||||
offsetY: number
|
||||
blur: number
|
||||
color: string
|
||||
}
|
||||
videoWidth?: number
|
||||
videoHeight?: number
|
||||
}
|
||||
|
||||
export const useVideoSubtitleEmbedding = async (
|
||||
@@ -36,18 +36,18 @@ export const useVideoSubtitleEmbedding = async (
|
||||
options = {
|
||||
videoWidth: 1920,
|
||||
videoHeight: 1080,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`video clip: ${videoUrl}`)
|
||||
|
||||
|
||||
const videoClip = new MP4Clip((await fetch(videoUrl)).body!)
|
||||
const videoSprite = new OffscreenSprite(videoClip)
|
||||
videoSprite.time = { duration: videoClip.meta.duration, offset: 0 }
|
||||
await videoSprite.ready;
|
||||
await videoSprite.ready
|
||||
|
||||
const srtSprite = new OffscreenSprite(
|
||||
new EmbedSubtitlesClip(await(await fetch(srtUrl)).text(), {
|
||||
new EmbedSubtitlesClip(await (await fetch(srtUrl)).text(), {
|
||||
videoWidth: 1920,
|
||||
videoHeight: 1080,
|
||||
fontSize: 36,
|
||||
@@ -62,20 +62,20 @@ export const useVideoSubtitleEmbedding = async (
|
||||
...options,
|
||||
})
|
||||
)
|
||||
await srtSprite.ready;
|
||||
await srtSprite.ready
|
||||
srtSprite.time = { duration: videoClip.meta.duration, offset: 0 }
|
||||
|
||||
const combinator = new Combinator({
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
});
|
||||
})
|
||||
|
||||
await combinator.addSprite(videoSprite);
|
||||
await combinator.addSprite(srtSprite);
|
||||
await combinator.addSprite(videoSprite)
|
||||
await combinator.addSprite(srtSprite)
|
||||
|
||||
const srcBlob = URL.createObjectURL(
|
||||
await new Response(combinator.output()).blob()
|
||||
);
|
||||
)
|
||||
|
||||
return srcBlob;
|
||||
};
|
||||
return srcBlob
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user