Share this page

# web.streamPlay

Starts playing a media stream.

Example | Stream Functions

## Syntax

`

web.streamPlay( {object} );

`

## JavaScript Object

    {
       id:<string>,
       playingDuration:<value>,
       speed: <value>
    }

Property Name | Description
--- | ---
id | The identifier passed to web.streamOpen.
playingDuration | The length of time to play in seconds. If not passed, the entire stream is played. If the play time is longer than the step download timeout in the runtime settings, the step fails.
speed | The play speed in multiples of the normal rate (1). The supported multiples are 0.5, 1.0, 1.5, and 2.0. Default = 1

## Return Values

Not applicable

## Parameterization

Standard parameterization is not available for this function.

## General Information

The web.streamPlay starts playing a media stream.

This function is not recorded. You can insert it manually into your script.

## Example

The following example implements the basic streaming flow skeleton:

1. Play the movie from the beginning (the entire movie duration is XXX).
   web.streamPlay( { id : n, playingDuration : XXX } );

2. Pause the movie.
   web.streamPause( { id : n, pausingDuration : XXX } );

3. Stop the movie.
   web.streamStop( { id : n } );

HTTP

Copy code

    function 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;
    }

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