Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add new event renderTime to combinator while output #356

Conversation

caohongz
Copy link
Contributor

使用场景为av-canvas在createCombinator时如果有tickInterceptor处理音视频,且这个过程中需要使用到当前渲染时间,在av-canvas外部是无法获取的,因此需要在combinator中增加一个渲染时间的事件通知。

Copy link

changeset-bot bot commented Jan 15, 2025

🦋 Changeset detected

Latest commit: 54eb491

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@webav/av-cliper Patch
@webav/av-canvas Patch
@webav/av-recorder Patch
WebAV-Doc-Site Patch
@webav/internal-utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@hughfenghen
Copy link
Member

素材一般无需知道 Combinator 的时间,这样可以保持简单性。

请描述你的场景(背景问题)。

@caohongz
Copy link
Contributor Author

素材一般无需知道 Combinator 的时间,这样可以保持简单性。

请描述你的场景(背景问题)。

视频素材关联滤镜效果,滤镜对象也是剪辑轨道中,因此需要判断当前播放时间是否在滤镜对象范围内,以此来给视频素材添加滤镜效果。
image

@hughfenghen
Copy link
Member

spr.time.offset + tickTime 是当前帧的绝对时间,你在赋值tickInterceptor的时候,用闭包存一下 spr.time.offset 是否就满足需要了?

const sprOffsetTime = spr.time.offset
spr.getClip().tickInterceptor = (time, ret) => {
  const absTime = sprOffsetTime + time
  // ... 其他帧处理逻辑
  return ret
}

@caohongz caohongz closed this Jan 15, 2025
@caohongz
Copy link
Contributor Author

spr.time.offset + tickTime 是当前帧的绝对时间,你在赋值tickInterceptor的时候,用闭包存一下 spr.time.offset 是否就满足需要了?

const sprOffsetTime = spr.time.offset
spr.getClip().tickInterceptor = (time, ret) => {
  const absTime = sprOffsetTime + time
  // ... 其他帧处理逻辑
  return ret
}

方法可行,是我没注意到tickInterceptor的传参情况。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants