Configure nDVR using the Wowza Streaming Cloud REST API

Learn how to use the Wowza Streaming Cloud REST API to record a live stream while simultaneously allowing viewers to play or pause the live stream, rewind it to a previously recorded point, or resume viewing at the current live point.

Note: Support for this feature will vary depending on the player. It will not work with Wowza Player. For best results, we recommend testing in the player of your choice before your live event is scheduled to begin.

Add a live stream


  1. Using the Wowza Streaming Cloud REST API, create a live stream.

    Live stream parameters

    Parameter Data Type Description
    aspect_ratio_height integer

    The height, in pixels, of the output rendition.

    This value should correspond to the aspect ratio (widescreen or standard) of the video source and be divisible by 8. Set the aspect ratio of the live stream to match the aspect ratio in your encoder settings.

    aspect_ratio_width integer

    The width, in pixels, of the output rendition.

    This value should correspond to the aspect ratio (widescreen or standard) of the video source and be divisible by 8. Set the aspect ratio of the live stream to match the aspect ratio in your encoder settings.

    billing_mode string The billing mode for the stream. The default is pay_as_you_go.
    broadcast_location string The region that's closest to where your stream originates. For a list of valid regions, see the API reference documentation.
    encoder string The video source for the live stream.
    name string The name of the live stream. Enter an alphanumeric string that is short (maximum 200 characters) and descriptive, for example, MynDVRStream.
    transcoder_type string The type of transcoder, either transcoded for streams that are transcoded into adaptive bitrate renditions or passthrough for streams that aren't processed by the transcoder. The default is transcoded.
    recording boolean If true, creates a recording of the live stream. The recording starts when the live stream starts and stops automatically when the live stream stops. The default is false.
     
    Note: For a full list of live stream parameters, see Live Streams in the Wowza Streaming Cloud API reference.

    Example request and response

    Notes:

    curl -X POST \
    -H "Content-Type: application/json" \
    -H "wsc-api-key: ${WSC_API_KEY}" \
    -H "wsc-access-key: ${WSC_ACCESS_KEY}" \
    -d '{
       "live_stream": {
         "aspect_ratio_height": 720,
         "aspect_ratio_width": 1280,
         "billing_mode": "pay_as_you_go",
         "broadcast_location": "us_west_california",
         "delivery_method": "push",
         "encoder": "other_rtmp",
         "name": "MynDVRStream",
         "recording": true,
         "transcoder_type": "transcoded"
       }
    }' "${WSC_HOST}/api/${WSC_VERSION}/live_streams"

    This request creates a live stream with an id parameter. The details of the live stream's configuration are listed in the response.

    {
       "live_stream": {
         "id": "1234abcd",
         "name": "MynDVRStream",
         "encoder": "other_rtmp",
         "recording": true,
         ...
       }
    }

  2. After creating the live stream, enable the playlistSeconds property on the stream target associated with the live stream you just created.

Enable the playlistSeconds property


The playlistSeconds property determines how far back viewers are able to rewind the stream.

Section Key Value Description
playlist playlistSeconds integer The number of seconds in the master playlist. The default is 100. Valid values are any integer between 6 and 28800 (8 hours).

Example requests


Notes:

curl -X POST \
-H "Content-Type: application/json" \
-H "wsc-api-key: ${WSC_API_KEY}" \
-H "wsc-access-key: ${WSC_ACCESS_KEY}" \
-d '{
  "property": {
    "key": "playlistSeconds",
    "section": "playlist",
    "value": 28800
  }
}' "${WSC_HOST}/api/${WSC_VERSION}/stream_targets/[stream_target_id]/properties"

More resources