如何检测,当视频缓冲?视频

由网友(你可以滚了)分享简介:今天我的问题涉及与Flash AS3视频缓冲。 (流式或渐进),我希望能够检测到当视频被缓冲,这样我就可以显示某种动画让用户知道要等一点点时间。目前我的影片将启动,举行第1帧3-4秒,然后播放。均田给IM pression该视频被暂停或损坏:(更新由于 iandisme 我相信我遇到了正确的方向了。 将NetStatu...

今天我的问题涉及与Flash AS3视频缓冲。 (流式或渐进),我希望能够检测到当视频被缓冲,这样我就可以显示某种动画让用户知道要等一点点时间。

目前我的影片将启动,举行第1帧3-4秒,然后播放。均田给IM pression该视频被暂停或损坏:(

更新

由于 iandisme 我相信我遇到了正确的方向了。 将NetStatusEvent从LiveDocs中的。在我看来,这是工作中的关键地位NetStream.Buffer.Empty所以我加了一些code。在那里,看看这会触发我动画或跟踪语句。没有运气,但是当缓冲区已满,会触发我的code:/也许我的视频总是介于 Buffer.Empty Buffer.Full 这就是为什么它不会触发任何code当我测试案例 Buffer.Empty

当前code

 公共职能的netStatusHandler(事件:将NetStatusEvent):无效
  {
     //处理网络状态事件
     开关(event.info。code)

        {
            案NetStream.Buffer.Empty:
                  跟踪(☼☼☼缓冲!); //<  - 从来没有痕迹
                  的addChild(bufferLoop); //<  - 不执行
            打破;

            案NetStream.Buffer.Full:
                  跟踪(☼☼☼FULL!); //<  - 跟踪作品在这里
                  removeChild之(bufferLoop); //<  - 让做任何其他的code
            打破;

            案NetStream.Buffer.Flush:
                  跟踪(☼☼☼FLUSH!);
                  //不知道这是非常重要的
            打破
        }
    }
 

解决方案 html5 的video 怎么检测是否缓冲完毕

您使用自定义轧球员?我知道FLVPlayback类有一个缓存事件的内置

如果你不使用的FLVPlayback,NetStream对象会触发将NetStatusEvent,其中包括一个 info对象每次启动或停止缓冲时间。您应该能够捕捉到这一事件和播放/隐藏动画这一点。

my question today deals with Flash AS3 video buffering. (Streaming or Progressive) I want to be able to detect when the video is being buffered, so I can display some sort of animation letting the user know to wait just a little longer.

Currently my video will start up, hold on frame 1 for 3-4 secs then play. Kinda giving the impression that the video is paused or broken :(

Update

Thanks to iandisme I believe I'm faced in the right direction now. NetStatusEvent from livedocs. It seems to me that the key status to be working in is "NetStream.Buffer.Empty" so I added some code in there to see if this would trigger my animation or a trace statement. No luck yet, however when the Buffer is full it will trigger my code :/ Maybe my video is always somewhere between Buffer.Empty and Buffer.Full that's why it won't trigger any code when I test case for Buffer.Empty?

Current Code

public function netStatusHandler(event:NetStatusEvent):void 
  {
     // handles net status events
     switch (event.info.code) 

        {
            case "NetStream.Buffer.Empty":
                  trace("☼☼☼ Buffering!"); //<- never traces
                  addChild(bufferLoop);    //<- doesn't execute
            break;

            case "NetStream.Buffer.Full":
                  trace("☼☼☼ FULL!");      //<- trace works here
                  removeChild(bufferLoop); //<- so does any other code
            break;

            case "NetStream.Buffer.Flush":
                  trace("☼☼☼ FLUSH!");
                  //Not sure if this is important
            break
        }
    }

解决方案

Are you using a custom-rolled player? I know the FLVPlayback class has a buffering event built-in.

If you're not using FLVPlayback, the NetStream object fires a netStatusEvent that includes an info object every time it starts or stops buffering. You should be able to capture that event and play/hide your animation with that.

阅读全文

相关推荐

最新文章