Share this page

# Web Stream Event Callback

Invoked zero or more times when an event occurs.

## C Language

void <name chosen by function creator> ( "ID=<string>", "State=<n>" );

Stream Functions

Argument | Description
--- | ---
ID | The StreamID to be used in other actions on the stream. The ID is created with this function call. An integer greater than 0.
State | A value of WEB_STREAM_CB_EVENT_ENUM

## Return Values

No value returned.

## Parameterization

Standard parameterization is not available for this function.

## General Information

The event report callback is invoked zero or more times when events occur.

WEB_STREAM_CB_EVENT_ENUM
Enum | Value | Event occurs when
--- | --- | ---
STREAM_STATUS_INIT | 0 | Callback event after the stream item created. Before the stream data transformed in API web_stream_open
STREAM_STATUS_START | 1 | Callback event when start the data transform
STREAM_STATUS_RELOAD | 2 | Callback event when reload the url(for live video)
STREAM_STATUS_BUFFERING | 3 | Callback event when the playing time > buffer data loaded
STREAM_STATUS_CLOSE | 4 | Callback event after the streaming closed
STREAM_STATUS_PLAY | 5 | Callback event after the streaming set to play
STREAM_STATUS_PAUSE | 6 | Callback event after the streaming set to pause
STREAM_STATUS_SEEK | 7 | Callback event when seek a specific time
STREAM_STATUS_STOP | 8 | Callback event after the streaming stopped
STREAM_STATUS_FAIL | 9 | Callback event after the streaming stopped on failure

## Example

This is an example of a web streaming script:

Copy code

    Action()
    {
          /**
          HTML5 Video
          /*/
          web_stream_open("ID=1", "URL=http://my_server/streaming-test/Video2/Class%20-%206.mp4", "EventReportCB=PrintBytes", "Protocol=HTTP", "StreamBufferingTimeout=38", LAST);
          web_stream_set_param_double("1",SPEED, 2.0);
          web_stream_set_param_int("1", BANDWIDTH, 2000000);
          web_stream_set_param_int("1", BUFFERING_TIMEOUT, 60);

          web_stream_get_state_string("1", SERVER_IP, "ServerIP");
          lr_output_message("IP:, %s",lr_eval_string("{ServerIP}"));
          lr_output_message("Movie Length : %lf",web_stream_get_param_double("1", Duration));

          /***
          Play a video. Seek forward, seek backward, seek from the beginning, pause, and stop.
          **/
          //Play for 30 sec

          lr_think_time(15);
          lr_start_transaction("HTTP Stream");

          web_stream_play("ID=1", "PlayingDuration=30", "Speed=1.5", LAST);
          lr_vuser_status_message("Current time in movie:%lf", web_stream_get_param_double("1", CURRENT_TIME));

          web_stream_pause("ID=1","PausingDuration=20", LAST);
          lr_vuser_status_message("Current time in movie:%lf", web_stream_get_param_double("1", CURRENT_TIME));

          web_stream_play("ID=1", "PlayingDuration=10", LAST);
          lr_vuser_status_message("Current time in movie:%lf", web_stream_get_param_double("1", CURRENT_TIME));

          web_stream_seek("ID=1", "TimeOffset=11", LAST);
          lr_vuser_status_message("Current time in movie:%lf", web_stream_get_param_double("1", CURRENT_TIME));

          web_stream_play("ID=1", "PlayingDuration=10", LAST);
          lr_vuser_status_message("Current time in movie:%lf", web_stream_get_param_double("1", CURRENT_TIME));

          web_stream_seek("ID=1", "RelativeOffset=90", LAST);
          lr_vuser_status_message("Current time in movie:%lf", web_stream_get_param_double("1", CURRENT_TIME));

          web_stream_play("ID=1", "PlayingDuration=10", LAST);
          lr_vuser_status_message("Current time in movie:%lf", web_stream_get_param_double("1", CURRENT_TIME));

          web_stream_seek("ID=1", "RelativeOffset=-17", LAST);
          lr_vuser_status_message("Current time in movie:%lf", web_stream_get_param_double("1", CURRENT_TIME));

          web_stream_stop("ID=1", LAST);

          lr_end_transaction("HTTP Stream", LR_AUTO);

          web_stream_close("ID=1", LAST);

          return 0;
    }

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: