User Guide

state (RealMedia) 1013
The streaming process is initiated when the playhead enters the span of the RealMedia sprite in
the Score, the
play method is invoked on a RealMedia sprite or cast member, or a user clicks the
Play button in the RealMedia viewer. Calling this property returns a numeric value indicating the
state of the streaming process for the RealMedia cast member. For each state, there is one or more
corresponding
mediaStatus (RealMedia, Windows Media) property value; each mediaStatus
value is observed only in one state. For example, the
mediaStatus property values #seeking and
#buffering are present only when the value of state is 3.
The value of the
state property provides important information in terms of performing Lingo
on a cast member. If
member.state is less than 2, some of the Lingo properties may be incorrect,
and as a result, any Lingo relying on property data would be incorrect. When
member.state is
greater than or equal to 2 and less than 4, the RealMedia cast member is not displayed, but all the
Lingo properties and methods have well-defined values and can be used to perform Lingo
operations on the cast member.
When the streaming process is initiated, the
state property cycles through the following states,
unless an error (-1) occurs, which prevents the streaming process from starting:
-1 (error) indicates that there is something wrong, possibly a leftover error from the previous
RealMedia stream. You may get more information by checking the
lastError property. This
state is the equivalent of
#error for the mediaStatus property.
0 (closed) indicates that streaming has not begun, or that cast member properties are in initial
states or are copies from an earlier playing of the cast member. This state is the equivalent of
#closed for the mediaStatus property.
1 (connecting) indicates that streaming has begun but is in the very early stages of connecting to
the server, and there is not enough information available locally to do anything with the cast
member. This state is the equivalent of
#connecting for the mediaStatus property.
2 (open) indicates that the Lingo properties have been refreshed from the actual stream. When
state is greater than or equal to 2, the height, width, and duration properties of the
RealMedia stream are known. This state is transitory and quickly changes to state 3. This state is
the equivalent of
#opened for the mediaStatus property.
3 (seeking or buffering) indicates that all of the RealMedia cast member’s Lingo properties are
current, but the cast member is not quite ready to play. The Stage or RealMedia viewer displays a
black rectangle or the RealNetworks logo. If this state is the result of rebuffering due to network
congestion, the
state value quickly changes back to 4 (playing). This state is the equivalent of
#buffering or #seeking for the mediaStatus property.
4 (playing) indicates that the RealMedia stream is playing (or paused) without problems or
errors. This is the state during normal playback. This state is the equivalent of
#playing or
#paused for the mediaStatus property.
Example
The following examples show that the state of streams in sprite 2 and the cast member Real is 0,
which is closed:
-- Lingo syntax
put(sprite(2).state) -- 0
put(member("Real").state) -- 0