Flex Functions (FLEX) > Alphabetical List of Functions > RTMP > flex_rtmp_receive_stream

flex_rtmp_receive_stream

Receives streaming data from an RTMP server.

Example: flex_rtmp_receive_stream Alphabetical Listing of Flex Functions (FLEX)
int flex_rtmp_receive_stream( const char *stepname, "ConnectionID=<connection identifier>", ["Snapshot=<snapshot_file>",]["ResponseParameter=<resp_param>",] ["Timeout=<timeout>",] ["ContinueToNextStepAfter=<msec>",] [ContinueMode=<AbsoluteTimestamp|DeltaFromNow>,] [LAST );

This function returns LR_PASS (0) on success or LR_FAIL (1) on failure. Note that LR_PASS and LR_FAIL generally indicate whether the function call completed without an exception, and not that the test step succeeded.

All input string arguments (char type) except the step name can be parameterized using standard parameterization.

Arguments

Name Comments
stepname A descriptive, unique name for this step. Use any text. Mandatory.
ConnectionID The unique name of the connection on which this function operates. Do not change the recorded ID. Mandatory.
Snapshot The name of the snapshot file (for example, "Snapshot=t31.inf") is generated automatically. Do not change it. When manually coding a Vuser script function call, do not enter it. When copying an existing function call, delete the Snapshot argument. Optional.
ResponseParameter ResponseParameter the name of the parameter in which to store all server responses for this step that are text. Binary binary data is not saved. Optional.
Timeout The wait time for the response to arrive from the RTMP server, in milliseconds. If the timeout is exceeded, the function returns LR_FAIL. Optional. If no timeout value is passed, the function uses the Receive Timeout specified in the Run-time Settings.
ContinueToNextStepAfter The minimum play duration of the stream to download before continuing to the next step (milliseconds). How the duration is interpreted depends on the ContinueMode argument. See below, Continue Mode.
ContinueMode One of AbsoluteTimestamp (default) or DeltaFromNow. See below, Continue Mode
LAST The delimiter marking the end of the argument list.

General Information

The flex_rtmp_receive_stream function waits for and receives streaming data from the server.

Data is received until either the server sends a STOP command, the download times out, or enough of the media downloads to play for the ContinueToNextStepAfter time. To resume receiving the stream after ContinueToNextStepAfter time, invoke flex_rtmp_receive_stream again with the same connection ID.

Data received using the flex_rtmp_receive_stream function is recognized as a response to a flex_rtmp_send function if the functions refer to the same ConnectionID argument.

Continue Mode

Each chunk of the streaming feed has a time stamp indicating play duration from the beginning of the stream. When downloading a clip, the initial time stamp is generally 0. When downloading a live feed, the initial time stamp received depends on how long the feed has been working at the time this Vuser begins receiving the stream. When resuming a paused stream, the initial time stamp depends on when the Pause was sent.

If ContinueMode=AbsoluteTimestamp or if no mode is specified, then after a time stamp having the ContinueToNextStepAfter value or greater is received, the script run proceeds to the next step.

For example, if a movie is downloading and ContinueToNextStepAfter=60000, flex_rtmp_receive_stream returns and the script continues to the next step after enough of the stream has downloaded for the movie to run for at least one minute.The stream may continue in the background on the same socket, but this will not be reflected in the logs.

If ContinueMode=DeltaFromNow, then LoadRunner saves the first time stamp received. This function returns when a time stamp of at least the initial time stamp plus the ContinueToNextStepAfter value is received.

For example, ContinueMode=DeltaFromNow and ContinueToNextStepAfter=60000. The first time stamp received from a live stream is 100,000. flex_rtmp_receive_stream returns and the script continues to the next step after a time stamp of 160,000 or greater is received.