Web Stream Event Callback

Invoked zero or more times when an event occurs.

Example Stream Functions

Syntax

<name choosen by function creator> ( id, state );
Property Name Description
id The identifier passed to web.streamOpen.
state See the table below for possible state values.

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.

State Values:
Enum Value

Event Occurs when:

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

Example

This is an example of a web streaming script:

The following examples implement the basic streaming flow skeleton:Play the movie from the beginning (the entire movie duration is XXX).
web.streamPlay( { id : n, playingDuration : XXX } );Pause the movie.
web.streamPause( { id : n, pausingDuration : XXX } );Stop the movie.
web.streamStop( { id : n } ); HTTPfunction Action(){    //Open an HTTP stream
    web.streamOpen(
        {
            id : 1,
            url : 'http://myhost/streaming-test/video/tiny.mp4',
            protocol : 'HTTP'
        }
    );    //Play for 10s
    web.streamPlay( { id : 1, playingDuration : 10 } );
        //Pause for 5s
    web.streamPause( { id : 1, pausingDuration : 5 } );
        //Seek to 00:00:20
    web.streamSeek( { id : 1, timeOffset : 20 } );    //Change the speed to 1.5
    web.streamSetParamDouble('1',web.SPEED, 1.5);    //Play for 10s
    web.streamPlay( { id : 1, playingDuration : 10 } );    //Get bytes received
    var bytes = web.streamGetParamInt('1',web.BYTES_RECEIVED);    //Close streaming
    web.streamClose(
        {
            id : 1
        }
    );     return 0;