在自定义 Flv 播放器上画圆圈

发布于 2024-09-17 19:06:11 字数 456 浏览 10 评论 0原文

好吧,我有自定义的 flv 播放器,它可以读取 XmL 并在 Flv 视频上绘制圆圈。位置和时间在 XML 中指定。我用as3 getTimer()函数进行计算。无论您暂停多长时间然后再次播放,它都可以正常工作。圆圈在正确的时间显示。

现在我有两个问题

1-如何重置 getTimer?当允许用户播放另一个 swf 时需要它。 2- 除了 getTimer 计算之外还有其他方法吗?我没有使用 Timer 类,因为它依赖于帧脚本执行时间,并且可能会产生错误的结果,因此这不如 getTimer() 函数准确。 3-由于我使用的是自定义滑块,所以每次用户单击或拖动滑块时,我都必须进行计算 getTimer() 函数,然后减去秒等等。但当用户播放另一个 swf 时,它会变得非常困难,因为我的计算是基于 getTimer() 函数。

如果有任何开源项目可用,请转发我的链接,但我希望它也能在 Flash Player 和 Air Player 上运行?

Well i have the custom flv player which reads an XmL and draws circles on Flv video. Position and time is specified in the XML. I did calculation with as3 getTimer() function. It works fine, no matter how long u pause and then play again. Circles are shown at right time.

Now i have two problems

1- How getTimer can be reset?? it is required when user is allowed to play another swf..
2- Is there any other way besides getTimer calculation. I am not using Timer Class as it is Dependant on Frame-Script Execution time and may yield wrong result so this is not as accurate as getTimer() function.
3- As i am using Custom Slider , so i have to do calculations each time when user click or drag slider w.r.t getTimer() function and then subtracts seconds and all that. but again it goes very hard when user plays another swf as my calculations are based on getTimer() Function.

If any open-source project is available , kindly forward me link but i want it to run at Flash Player and air player too?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扭转时空 2024-09-24 19:06:11

我会尝试为您指出正确的方向,但首先回答您的问题:

  1. 否(除了使用计时器)
  2. 应该不会更困难

扩展第 3 点 ,因为这就是您的解决方案所在,它真的不应该再困难了。您需要做的就是跟踪当前 FLV 的开始时间。只要你掌握了这一点,数学就没有什么不同。最简单的方法是引入您自己的 reset 函数,并将 getTimer 包装在自定义函数中以添加所需的其余功能。类似这样:

var startTime:int;

function resetTimer():void {
    startTime = getTimer();
}

function getTime():int {
    return getTimer() - startTime;
}

在上面的示例中,您始终从 getTime 而不是 getTimer 访问当前时间,除此之外,一切都是相同的。只需确保在需要时调用 resetTimer 即可。

我希望这有帮助!

I'll try to point you in the right direction, but first answers to your questions:

  1. No
  2. No (besides using a Timer)
  3. It shouldn't be any more difficult

To expand on number 3, because this is where your solution lies, it really shouldn't be anymore difficult. What you need to do its track the time that the current FLV started. As long as you have that the math really is no different. The simplest thing would be to introduce your own reset function, and wrap getTimer in a custom function to add the rest functionality needed. Something like this:

var startTime:int;

function resetTimer():void {
    startTime = getTimer();
}

function getTime():int {
    return getTimer() - startTime;
}

In the above example, you would always access the current time from getTime rather than getTimer, beyond that everything is the same. Just make sure you call resetTimer when needed.

I hope that helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文