错误? NetStream统计不会恢复后inital暂停再求错误、NetStream、inital

2023-09-08 14:45:21 作者:一颗心只给一个人

我遇到一些奇怪的行为,我找不到任何记录 知识。

I'm experiencing some strange behavior for which I can't find any documented knowledge.

下面是发生了什么:

调用play()方法后,与NetStream暂停时对netStatus code 是NetStream.Play.Start。这将禁用自动的默认行为 播放。与之前的或者的togglePause时()或继续()恢复,执行求 操作。当您尝试恢复与togglePause时()或继续(),该 NetStream的不会重新开始播放。

After calling the play() method, a netstream is paused when the NetStatus code is "NetStream.Play.Start". This disables the default behavior of automatically playing. Before resuming with either togglePause() OR resume(), perform a seek operation. When you attempt to resume with togglePause() or resume(), the netstream will not start playing again.

如果你只是立即暂停(),然后重新开始(),而不会寻求()之间,它 恢复正常。

If you just immediately pause() then resume() without a seek() in between, it resumes fine.

另外,如果你约250ms的延迟初始暂停时,可以再求()和 随后恢复(),没有任何问题。

Also, if you delay the initial pause by about 250ms, you can then seek() and subsequently resume() with no problems.

我张贴演示和源代码在这里: http://drinkspiller.cannonballinteractive.com/temp/ResumeAfterPauseAndSeek/

I posted a demo and source here: http://drinkspiller.cannonballinteractive.com/temp/ResumeAfterPauseAndSeek/

在code是例如code直接为NetStream的AS3的文档轻微 增加的办理初始暂停和处理搜索和恢复按钮。 没有太多吧。

The code is the example code directly from the AS3 docs for NetStream with minor additions to handle the initial pause and handle the seek and resume buttons. There's not much to it.

请注意,我通过调用stream.seek(0),则stream.pause()暂停;本 确保了视频实例,而不是什么第一帧显示。一样 出现问题不stream.seek(0),只有使用stream.pause()停止 播放。

Note that I am pausing by calling stream.seek(0) then stream.pause(); This ensures the first frame shows in the Video instance instead of nothing. The same behavior occurs without stream.seek(0) and only using stream.pause() to stop playback.

我也试着推迟调用​​startPaused();直到缓冲区满事件 code,但该行为是相同的。

I've also tried delaying the call to startPaused(); until the buffer full event code but the behavior is the same.

谁能帮我找到一个合理的解决办法或证实对我来说,这是一个 错误?非常感谢!

Can anyone help me find a sensible workaround or confirm for me that this is a bug? Many thanks!

推荐答案

肯定有一些错误在作怪(和一些贫穷的文档)。但是,我认为有两个潜在的问题,您的样本:

There are definitely some bugs at play (and some poor documentation). But, I think there are two potential issues with your sample:

我不认为这是获得有关FLV元数据之前调用NetStream.seek一个好主意。 (考虑一个持续时间是从元数据中提取)。我不知道是否有有关正式文件,但我从经验发现它可能会产生问题。你可以尝试把任何停顿/寻求onMetaData事件处理程序的事件。

I don't think it's a good idea to call NetStream.seek before receiving metadata about the FLV. (Consider that duration is extracted from the metadata). I don't know if there's official documentation about that, but I've found from experience it can be problematic. You might try putting any pause/seek events in the onMetaData event handler.

我有限的理解是,元数据与FLV数据包括内联。它可以在任何地方,但理想,通常,它是在该文件的前面。因此,当渐进式下载,将NetStream必须得到足够的信息来获得它需要与视频(如搜索)做更多先进的东西的元数据。在250ms的暂停将在这可以解释为什么它为你工作。

My limited understanding is that metadata is included inline with the FLV data. It can be anywhere, but ideally and usually, it's at the front of the file. So when progressively downloading, the NetStream must receive enough information to get the metadata it needs to do more advanced things with the video (like seeking). That could explain why it worked for you when putting in a 250ms pause.

您样品FLV是连接codeD不同于其他的FLV我曾经使用过。我不知道是什么原因,但如果我更改,以引用不同的FLV,一切都很好工作(后问题#1是写给那是。)

Your sample FLV is encoded differently from other FLVs I've worked with. I'm not exactly sure why, but if I changed to reference a different FLV, everything worked great (after issue #1 was addressed that is.)

我想,也许你​​的样品FLV只是缺少关键帧,这是需要追求的。我试着重新编码,包括关键帧,它仍然没有工作,虽然。我真的不知道有什么关于FLV不同,如果任何人都可以指出这一点,我会觉得非常有用了。

I thought maybe your sample FLV was just missing keyframes, which are required for seeking. I tried reencoding to include keyframes and it still didn't work though. I'm not really sure what's different about that FLV, and if anyone can point that out, I'd find it very useful too.

使用寻求(0)调用,以确保有一个海报框架至于......我没有这样做我自己。这可能也与FLV形式如何都带codeD虽然。

Regarding using a seek(0) call to make sure there's a poster frame... I haven't had to do that myself. This could also be related to how FLVs are encoded though.