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

用VideoFrame列表作为ImgClip的构造参数,报错 #77

Closed
xeoshow opened this issue Apr 16, 2024 · 5 comments
Closed

用VideoFrame列表作为ImgClip的构造参数,报错 #77

xeoshow opened this issue Apr 16, 2024 · 5 comments

Comments

@xeoshow
Copy link

xeoshow commented Apr 16, 2024

下面的videoFrameList,是视频一帧帧的列表,是否可以用来构造ImgClip?并使得合成后也是同样的视频内容播放(我们借助Combinator仅仅add背景音频资源)。

      ......
      const videoFrame = new VideoFrame(offscreenCanvas, {timestamp: videoFrameTimestamp});
      videoFrameList.push(videoFrame);
      ......
      const imgClip = new ImgClip(videoFrameList);
      const mainSprite = new OffscreenSprite('mainSprite', imgClip);
      const com = new Combinator({
        width: logicalWidth,
        height: logicalHeight,
      });
      await com.add(mainSprite, { offset: 0, duration: 10});
      ......

尝试用上面代码,遇到下面错误,需要如何解决呢?
image

https://hughfenghen.github.io/WebAV/_api/av-cliper/classes/ImgClip.html#constructor
看文档,ImgClip应该是支持VideoFrame[]的?

@hughfenghen
Copy link
Member

因为你给的参数不是一个 VideoFrame 数组,你自己再检查一下代码。

或参考 #60 :代码高亮;提供可复现的 DEMO

@xeoshow
Copy link
Author

xeoshow commented Apr 17, 2024

上面代码显示,videoFrameList,应该是数组:

  const videoFrame = new VideoFrame(offscreenCanvas, {timestamp: videoFrameTimestamp});
  videoFrameList.push(videoFrame);

===

查遍了整个官方DEMO,貌似没看到VideoFrame数组作为ImgClip构造参数的例子,是否可以加一个这样的?这个场景应该还挺常见。

@hughfenghen
Copy link
Member

请注意优化 issue 内容格式、代码高亮

ImgClip clone 使用了 VideoFrame[] 构建的示例,你可以自己调试一下代码报错的原因。

反馈 Bug 时,提供调试信息是受欢迎的;如果非 Bug 调试过程也能加深你自己的理解。

@xeoshow
Copy link
Author

xeoshow commented Apr 17, 2024

上面报错截图就是所有相关的bug信息了,好像没有更多的别的输出。后面注意代码高亮哈。
官方可以来个 VideoFrame[] 构建的示例吗?ImgClip clone是个单独可运行的DEMO吗?没看到在哪...

@xeoshow
Copy link
Author

xeoshow commented Apr 17, 2024

另外,用VideoFrame[] 构建的话,new VideoFrame(offscreenCanvas, {timestamp: videoFrameTimestamp}),构建出来的ImgClip 是否也会按照给到的timestamp参数,像gif动图那样顺畅动态展示?再次谢谢。

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

No branches or pull requests

2 participants