User Guide
110 Client-Side ActionScript Language Reference
NetStream.time
Availability
■ Flash Player 6.
■ Flash Communication Server MX 1.0.
Usage
public time : Number [read-only]
Description
Property (read-only); for a subscriber stream, the number of seconds the stream has been
playing; for a publishing stream, the number of seconds the stream has been publishing. This
number is accurate to the thousandths decimal place; multiply by 1000 to get the number of
milliseconds the stream has been playing.
When you are publishing a stream, this property stops incrementing when you stop sending
data over the stream by calling
NetStream.attachVideo(false) or
NetStream.attachAudio(false). When you resume publishing by calling
NetStream.attachVideo(active_cam) or NetStream.attachAudio(active_mic), the
time property continues incrementing from where it left off, plus the time that elapsed while
no data was sent. When you stop publishing a stream by calling
Netstream.publish(false), the time property stops incrementing and is reset to 0 when
you resume publishing the stream.
For a subscribing stream, if the server stops sending data but the stream remains open, this
value stops incrementing. When the server begins sending data again, the value of this
property continues incrementing from where it left off plus the time that elapsed while no
data was sent. The value of this property continues to increment when the stream switches
from one playlist element to another. This property is set to 0 when
NetStream.play is called
with
flushPlaylists set to true, or when NetStream.close is called.
Example
The following example shows how, while you are publishing a stream, NetStream.time
continues to increment even while no data is being sent over a stream:
my_ns.attachVideo(active_cam);
my_ns.publish("SomeData", "live");
//After 10 seconds, my_ns.time = 10.
// You then stop sending data over the stream.
my_ns.attachVideo(false);
// Later you start sending data over the same stream.