Web Stream Event Callback

Invoked zero or more times when an event occurs.

ExampleStream Functions

Syntax

<name choosen by function creator> ( id, state );
Property Name Description
idThe identifier passed to web.streamOpen.
stateSee 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:
EnumValue

Event Occurs when:

web.STREAM_STATUS_INIT0Callback event after the stream item created. Before the stream data transformed in API web.streamOpen
web.STREAM_STATUS_START1Callback event when start the data transform
web.STREAM_STATUS_RELOAD2Callback event when reload the url(for live video)
web.STREAM_STATUS_BUFFERING3Callback event when the playing time > buffer data loaded
web.STREAM_STATUS_CLOSE4Callback event after the streaming closed
web.STREAM_STATUS_PLAY5Callback event after the streaming set to play
web.STREAM_STATUS_PAUSE6Callback event after the streaming set to pause
web.STREAM_STATUS_SEEK7Callback event when seek a specific time
web.STREAM_STATUS_STOP8Callback event after the streaming stopped
web.STREAM_STATUS_FAIL9Callback 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;