简体   繁体   English

我如何知道 AS3 中的 NetStream 加载了多少视频?

[英]How do I know how much of a video is loaded by a NetStream in AS3?

I'm making a video player in AS3 and was wondering how to find out how much of the video is currently cached/buffered.我正在 AS3 中制作视频播放器,想知道如何找出当前缓存/缓冲了多少视频。 I'm not sure what the correct terminology is, so I haven't been able to find it in the documentation.我不确定正确的术语是什么,所以我无法在文档中找到它。

NetStream.time gives me the current location of the video, so based on that I can display a progressbar. NetStream.time为我提供了视频的当前位置,因此我可以基于此显示进度条。

Underneath the progressbar, I want to display how much of the video has been loaded already.在进度条下方,我想显示已经加载了多少视频。 How do I find this value?我如何找到这个值?

You can use NetSteam.bytesLoaded and NetSteam.bytesTotal to get the total rough percentage loaded:您可以使用NetSteam.bytesLoadedNetSteam.bytesTotal来获取总的粗略加载百分比:

var bufferPercent:Number = myNetStream.bytesLoaded / myNetStream.bytesTotal;

// Use percentage to scale buffer bar.
myBufferBar.scaleX = bufferPercent;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM