ActionScript 3中的NetStream立即暂停并没有得到元 [英] Actionscript 3 NetStream immediately paused does not get metadata

查看:173
本文介绍了ActionScript 3中的NetStream立即暂停并没有得到元的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个基本的视频播放器在Flash CS5和ActionScript 3,对于这个基本的球员,我附上我的NetStream我的NetConnection,然后调用流的.play()方法来开始加载。虽然我想要的元数据和数据流开始缓冲,我不希望开始播放的时候了,于是我立即致电流的.pause()方法。不幸的是,当我立刻暂停,我流的客户onMetaData事件不总是叫,所以我不一定得到加载视频的总播放时间。

I am writing a basic video player in Flash CS5 and Actionscript 3. For this basic player, I attach my NetStream to my NetConnection, then call the stream's .play() method to begin loading. Although I want the metadata and for the stream to begin buffering, I do not wish to start playing right away, so I immediately call the stream's .pause() method. Unfortunately, when I pause immediately, my stream's client's onMetaData event is not always called, so I don't necessarily get the total playtime of the loaded video.

作为一种解决办法,我把电话给了暂停的方法调用onMetaData监听器里,但有时接受它的元数据之前,我的影片将发挥了一点,所以会继续玩,直到它。

As a workaround, I put the call to the "pause" method inside the onMetaData listener, but sometimes my video will have played a bit before receiving it's metadata, and will therefore continue to play until it does.

有没有到停止播放我的流,而且还让我的视频元数据的好方法?

Is there a good way to stop my stream from playing, and still get my video metadata?

推荐答案

好了,这里是思考这个不同的一个整洁的小路......您的视频对象不附加到您的流对象的时候了。启动流播放,同时呈现出请稍等视而不显示你的视频对象。在你调用onMetaData监听器,看看你是否已经存储的持续时间previously。如果没有,假设这是调用onMetaData第一次调用,存储时间,暂停播放,寻求流为0,然后装上视频对象。

Okay, here's a neat little way of thinking about this differently... Do not attach your video object to your stream object right away. Start your stream playing while showing a "please wait" visual WITHOUT your video object being displayed. In your onMetaData listener, see if you have stored a duration previously. If not, assume this is the first call to onMetaData, store the duration, pause playback, seek the stream to 0, THEN attach the video object.

用户将看到一个请稍候只是一秒钟,然后视频会出现停顿和放大器;随时可以发挥它的持续时间预期。用户将完全不知道该流起到了一个位,而他们等待。

The user will see a "please wait" for just a sec, then the video will appear, paused & ready to be played with it's duration times as expected. The user will be completely unaware that the stream played forward a bit while they were waiting.

这篇关于ActionScript 3中的NetStream立即暂停并没有得到元的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆