# Play streams directly from a transcoder with the Wowza Video REST API The Wowza VideoTM service REST API provides URLs you can use to deliver live streams to viewers or other video services directly from the transcoder, bypassing standard stream delivery through a CDN. You might choose to stream directly through the transcoder to reduce latency or to use a protocol not offered through a CDN. Direct playback URLs are often used to stream to services like Facebook, LinkedIn, Twitter, and others. When choosing to deliver your stream directly from a transcoder, consider the following feature details: - **Protocols supported** – Direct playback URLs are available for RTMP, RTSP, WOWZ, and WebRTC. - **Cost** – Egress costs for direct playback are typically greater than the costs associated with delivering streams to viewers through a CDN. For more information, see the terms of your Video subscription for details on the associated costs. - **Maximum viewer connections** – By default, direct playback is limited to 10 viewers. You can change the default value to allow additional viewers. The maximum number of viewers a transcoder can support varies depending on configuration options you selected when you set up the transcoder. Generally, adaptive bitrate transcoders are larger and support more viewer connections (up to 300) while passthrough transcoders are smaller and support fewer viewer connections. Make sure you do sufficient testing to ensure your streaming goals are met. ## Before you start You should be familiar with the following concepts: - **API authentication** **methods**. We use JSON web tokens for API authentication. See [Authentication](/docs/wowza-video/about-the-rest-api/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](/docs/wowza-video/about-the-rest-api/api-overview#tools-for-testing-the-api) for instructions. ## 1. Get direct playback URLs To get the playback URLs for a transcoder, you can use the following sample request, making sure to: - Set the `transcoder_id` in the request URL. #### Sample request Endpoint Reference ``` curl X GET \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/transcoders/[transcoder_id]" ``` #### Sample response The response includes: - A list of `protocols` for the transcoder - An array of `direct_playback_urls` for the delivery protocols. Each protocol has playback URLs for the source and for each output rendition. Select **json** above the sample responses below to see each of the bulleted items above. ``` "delivery_protocols": [ "rtmp", "rtsp", "wowz", "webrtc" ] ``` ``` "direct_playback_urls": { "rtmp": [ { "name": "source", "url": "rtmp://[subdomain].entrypoint.video.wowza.com/app-B8P6K226/4a07cfd4" }, { "name": "webrtc", "output_id": "0sxdnnfj", "url": "rtmp://[subdomain].entrypoint.video.wowza.com/app-B8P6K226/4a07cfd4_stream1" }, { "name": "V:1280x720+A:128K", "output_id": "vz5qfxqt", "url": "rtmp://[subdomain].entrypoint.video.wowza.com/app-B8P6K226/4a07cfd4_stream2" }, { "name": "V:854x480+A:128K", "output_id": "yypdk9rj", "url": "rtmp://[subdomain].entrypoint.video.wowza.com/app-B8P6K226/4a07cfd4_stream3" }, { "name": "V:640x360+A:128K", "output_id": "xcmj9w29", "url": "rtmp://[subdomain].entrypoint.video.wowza.com/app-B8P6K226/4a07cfd4_stream4" }, { "name": "V:512x288+A:128K", "output_id": "zyrnc2ng", "url": "rtmp://[subdomain].entrypoint.video.wowza.com/app-B8P6K226/4a07cfd4_stream5" }, { "name": "V:320x180+A:128K", "output_id": "kktcb2ld", "url": "rtmp://[subdomain].entrypoint.video.wowza.com/app-B8P6K226/4a07cfd4_stream6" } ], "rtsp": [ { "name": "source", "url": "rtsp://[subdomain].entrypoint.video.wowza.com:1935/app-B8P6K226/4a07cfd4" }, { "name": "webrtc", "output_id": "0sxdnnfj", "url": "rtsp://[subdomain].entrypoint.video.wowza.com:1935/app-B8P6K226/4a07cfd4_stream1" }, { "name": "V:1280x720+A:128K", "output_id": "vz5qfxqt", "url": "rtmp://[subdomain].entrypoint.video.wowza.com:1935/app-B8P6K226/4a07cfd4_stream2" }, { "name": "V:854x480+A:128K", "output_id": "yypdk9rj", "url": "rtsp://[subdomain].entrypoint.video.wowza.com:1935/app-B8P6K226/4a07cfd4_stream3" }, { "name": "V:640x360+A:128K", "output_id": "xcmj9w29", "url": "rtsp://[subdomain].entrypoint.video.wowza.com:1935/app-B8P6K226/4a07cfd4_stream4" }, { "name": "V:512x288+A:128K", "output_id": "zyrnc2ng", "url": "rtsp://[subdomain].entrypoint.video.wowza.com:1935/app-B8P6K226/4a07cfd4_stream5" }, { "name": "V:320x180+A:128K", "output_id": "kktcb2ld", "url": "rtsp://[subdomain].entrypoint.video.wowza.com:1935/app-B8P6K226/4a07cfd4_stream6" } ], "wowz": [ { "name": "source", "url": "wowz://[subdomain].entrypoint.video.wowza.com:1935/app-B8P6K226/4a07cfd4" }, { "name": "webrtc", "output_id": "0sxdnnfj", "url": "wowz://[subdomain].entrypoint.video.wowza.com:1935/app-B8P6K226/4a07cfd4_stream1" }, { "name": "V:1280x720+A:128K", "output_id": "vz5qfxqt", "url": "rtmp://[subdomain].entrypoint.video.wowza.com:1935/app-B8P6K226/4a07cfd4_stream2" }, { "name": "V:854x480+A:128K", "output_id": "bff5jwyv", "url": "wowz://[subdomain].entrypoint.video.wowza.com:1935/app-B8P6K226/4a07cfd4_stream3" }, { "name": "V:640x360+A:128K", "output_id": "xcmj9w29", "url": "wowz://[subdomain].entrypoint.video.wowza.com:1935/app-B8P6K226/4a07cfd4_stream4" }, { "name": "V:512x288+A:128K", "output_id": "zyrnc2ng", "url": "wowz://[subdomain].entrypoint.video.wowza.com:1935/app-B8P6K226/4a07cfd4_stream5" }, { "name": "V:320x180+A:128K", "output_id": "kktcb2ld", "url": "wowz://[subdomain].entrypoint.video.wowza.com:1935/app-B8P6K226/4a07cfd4_stream6" } ] "webrtc": [ { "name": "source", "url": "wss://[subdomain].entrypoint.video.wowza.com/webrtc-session.json" }, { "name": "webrtc", "output_id": "qw2p61nn", "url": "wss://[subdomain].entrypoint.video.wowza.com/webrtc-session.json", "application_name": "app-B8P6K226", "stream_name": "b19b3a52_stream1" }, { "name": "V:1280x720+A:128K", "output_id": "vz5qfxqt", "url": "rtmp://[subdomain].entrypoint.video.wowza.com/webrtc-session.json" "application_name": "app-B8P6K226", "stream_name": "b19b3a52_stream2" }, { "name": "V:854x480+A:128K", "output_id": "vj8mkthg", "url": "wss://[subdomain].entrypoint.video.wowza.com/webrtc-session.json", "application_name": "app-B8P6K226", "stream_name": "b19b3a52_stream3" }, { "name": "V:640x360+A:128K", "output_id": "7glwfzpf", "url": "wss://[subdomain].entrypoint.video.wowza.com/webrtc-session.json", "application_name": "app-B8P6K226", "stream_name": "b19b3a52_stream4" }, { "name": "V:512x288+A:128K", "output_id": "0w3fpbb2", "url": "wss://[subdomain].entrypoint.video.wowza.com/webrtc-session.json", "application_name": "app-B8P6K226", "stream_name": "b19b3a52_stream5" }, { "name": "V:320x180+A:128K", "output_id": "vv1jrzbz", "url": "wss://[subdomain].entrypoint.video.wowza.com/webrtc-session.json", "application_name": "app-B8P6K226", "stream_name": "b19b3a52_stream6" } ] } ``` ## 2. Change the number of direct connections to the transcoder To specify the number of connections allowed to the transcoder, you can use the following sample request, making sure to: - Set the `play_maximum_connections` in the request url to a valid value between 10 and the maximum number of viewers the transcoder supports. #### Sample request Endpoint Reference ``` curl -X PATCH \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${WV_JWT}" \ -d '{ "transcoder": { "play_maximum_connections": 20 } }' "${WV_HOST}/api/${WV_VERSION}/transcoders/[transcoder_id]" ``` #### Sample response ``` { "transcoder": { "created_at": "2017-10-25T11:53:28.508", "id": "1234abcd", "play_maximum_connections": 20, "updated_at": "2017-10-25T11:53:28.508" } } ```