Recipe 16.3.
Reading Playback Time
Problem
You
want to read the current
playback time of a video.
Solution
Use the time property of the
NetStream object.
Discussion
The time property of the
NetStream class is a read-only property that reports the
playback time of the video. The value is in seconds from the start
of the video. The following displays the playback time of a video
in a text field:
textField.text = videoStream.time + " seconds";
Note that the value is not rounded to the
nearest whole number. That means you can have values such as 1 as
well as values such as 5.235. If you need whole numbers, you can
use Math.round( ), Math.floor(
), or Math.ceil( ).
Since the time property is read-only,
you cannot use it to control playback. If you want to control
playback, use the seek( ) method as described in Recipe
16.5.
See Also
Recipes 4.3
and 16.5
|