Create and view player URLs with the Wowza Video REST API

When you add a live stream, the Wowza Video™ 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 methods. We use JSON web tokens for API authentication. See Authentication for more information.
  • Environment variables. We use environment variables for the API version and your JWT 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.
     

Sample request

Endpoint Reference

curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${WV_JWT}" \
-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"
   }
}' "${WV_HOST}/api/${WV_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 "Authorization: Bearer ${WV_JWT}" \
"${WV_HOST}/api/${WV_VERSION}/players/[player_id]/rebuild"

Related requests