Create and view player URLs with the Wowza Streaming Cloud REST API

When you add a live stream, the Wowza Streaming Cloud™ service creates two playback URLs: one for viewing the stream in a browser on a computer and one for viewing the stream on a mobile device. By using the REST API, you can view and edit those URLs as well as create additional URLs for playing streams at other bitrates. For example, you can create player URLs for other output renditions that a transcoder is using.

Before you start


You should complete the following tasks:

  • Create a live stream or a transcoder. You'll need the resulting player_id to create a player URL. View our Connect a source topics to learn how to create a live stream or transcoder for RTMP, RTSP, IP camera, SRT encoder, UDP encoder, WebRTC, and Wowza Streaming Engine.

You should be familiar with the following concepts:

  • API authentication method. Use HMAC authentication for production environments. For testing or proof of concept purposes only, use API key and access key authentication.
  • Environment variables for the API version and your API and access keys in the cURL API request examples in this topic to make it easier for you to copy, paste, and run commands in your Terminal or Command Prompt window. If you don't set environment variables for these values, you'll need to manually enter the correct values in the code samples throughout this tutorial. See Tools for testing the API for instructions.

1. Create a player URL


You can use the following sample request, making sure to:

  • Set the url of the player.
     
    If using Wowza CDN on Fastly targets, the HLS playback URL format is
    https://[wowzasubdomain].wowza.com/1/[stream_id]/[stream_name]/hls/live/playlist.m3u8

    If using Wowza CDN on Akamai targets, the HLS playback URL format is https://[wowzasubdomain].akamaihd.net/i/[stream_name]_[angle]@[stream_id]/master.m3u8

Sample request

Endpoint Reference

curl -X POST \
-H "Content-Type: application/json" \
-H "wsc-api-key: ${WSC_API_KEY}" \
-H "wsc-access-key: ${WSC_ACCESS_KEY}" \
-d '{
   "url": {
     "bitrate": "640",
     "height": "288",
     "label": "My384_playerurl",
     "url": "https://[wowzasubdomain].wowza.com/1/[stream_id]/[stream_name]/hls/live/playlist.m3u8",
     "width": "384"
   }
}' "${WSC_HOST}/api/${WSC_VERSION}/players/[player_id]/urls"

Sample response

The response includes:

  • A url for the player with the requested parameters.
{
   "url": {
     "bitrate": "640",
     "created_at": "2016-03-25T11:53:28.508",
     "height": "288",
     "id": "1234abcd",
     "name": "My384_playerurl",
     "updated_at": "2016-03-25T11:53:28.508",
     "url": "https://[wowzasubdomain].wowza.com/1/[stream_id]/[stream_name]/hls/live/playlist.m3u8",
     "width": "384"
   }
}

2. Rebuild the player

After adding or editing a player URL, you must rebuild the player in order for the changes to take effect.

You can use the following sample request, making sure to:

  • Set the player_id in the request url.
     

Sample request

Endpoint Reference

curl -X DELETE \
-H "wsc-api-key: ${WSC_API_KEY}" \
-H "wsc-access-key: ${WSC_ACCESS_KEY}" \ 
"${WSC_HOST}/api/${WSC_VERSION}/players/[player_id]/rebuild"

Related requests