|
可用性
Flash Player 6
Flash Communication Server MX
用法
public bufferTime : Number [只读]
public bufferTime : Number [只读]
描述
[table][tr][td] 属性(只读)。通过NetStream.setBufferTime()指派给缓冲区的秒数。默认值是。要确定当前缓冲区中的秒数,使用NetStream.bufferLength。
注意:Flash Media Server bufferTime属性的默认值与标准的ActionScript bufferTime属性的默认值是不同的。
例子
下面的范例动态的创建一个文本域来显示当前缓冲区中的秒数信息。这个文本域也显示视频被设置的
缓冲区的长度,以及缓冲区被填充的百分比。缓冲区被填充的百分比。
this.createTextField("buffer_txt", this.getNextHighestDepth(), 10, 10, 300, 22);
buffer_txt.html = true;
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
stream_ns.setBufferTime(3);
my_video.attachVideo(stream_ns);
stream_ns.play("video1.flv");
var buffer_interval:Number = setInterval(checkBufferTime, 100, stream_ns);
function checkBufferTime(my_ns:NetStream):Void {
var bufferPct:Number = Math.min(Math.round(my_ns.bufferLength/my_ns.bufferTime 100), 100);
var output_str:String = "<textformat tabStops=\'[100,200]\'>";
output_str += "Length: "+my_ns.bufferLength+"\\t"+"Time:
"+my_ns.bufferTime+"\\t"+"Buffer:"+bufferPct+"%";
output_str += "</textformat>";
buffer_txt.htmlText = output_str;
} |
|