From 3e99fac809ed021141a1508b967654583ca9e36d Mon Sep 17 00:00:00 2001 From: hughfenghen Date: Fri, 1 Nov 2024 15:54:14 +0800 Subject: [PATCH] feat: createCombinator support more augs --- .changeset/witty-suits-swim.md | 6 ++++++ packages/av-canvas/src/av-canvas.ts | 8 ++------ packages/av-cliper/src/combinator.ts | 2 +- packages/av-cliper/src/index.ts | 1 + 4 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 .changeset/witty-suits-swim.md diff --git a/.changeset/witty-suits-swim.md b/.changeset/witty-suits-swim.md new file mode 100644 index 00000000..8be653bc --- /dev/null +++ b/.changeset/witty-suits-swim.md @@ -0,0 +1,6 @@ +--- +'@webav/av-canvas': patch +'@webav/av-cliper': patch +--- + +feat: createCombinator support more augs diff --git a/packages/av-canvas/src/av-canvas.ts b/packages/av-canvas/src/av-canvas.ts index 9827328a..93add594 100644 --- a/packages/av-canvas/src/av-canvas.ts +++ b/packages/av-canvas/src/av-canvas.ts @@ -4,6 +4,7 @@ import { OffscreenSprite, VisibleSprite, MediaStreamClip, + ICombinatorOpts, } from '@webav/av-cliper'; import { renderCtrls } from './sprites/render-ctrl'; import { ESpriteManagerEvt, SpriteManager } from './sprites/sprite-manager'; @@ -406,12 +407,7 @@ export class AVCanvas { * * @see [视频剪辑](https://bilibili.github.io/WebAV/demo/6_4-video-editor) */ - async createCombinator( - opts: { - bitrate?: number; - __unsafe_hardwareAcceleration__?: HardwareAcceleration; - } = {}, - ) { + async createCombinator(opts: ICombinatorOpts = {}) { const com = new Combinator({ ...this.#opts, ...opts }); const sprites = this.#spriteManager.getSprites({ time: false }); if (sprites.length === 0) throw Error('No sprite added'); diff --git a/packages/av-cliper/src/combinator.ts b/packages/av-cliper/src/combinator.ts index 61c5f968..f12d36e0 100644 --- a/packages/av-cliper/src/combinator.ts +++ b/packages/av-cliper/src/combinator.ts @@ -3,7 +3,7 @@ import { OffscreenSprite } from './sprite/offscreen-sprite'; import { sleep } from './av-utils'; import { DEFAULT_AUDIO_CONF } from './clips'; -interface ICombinatorOpts { +export interface ICombinatorOpts { width?: number; height?: number; bitrate?: number; diff --git a/packages/av-cliper/src/index.ts b/packages/av-cliper/src/index.ts index cdb3c643..5845e9d4 100644 --- a/packages/av-cliper/src/index.ts +++ b/packages/av-cliper/src/index.ts @@ -14,5 +14,6 @@ export { OffscreenSprite } from './sprite/offscreen-sprite'; export { VisibleSprite } from './sprite/visible-sprite'; export { Rect } from './sprite/rect'; export { Combinator } from './combinator'; +export type { ICombinatorOpts } from './combinator'; export { Log } from '@webav/internal-utils';