Using Wowza Streaming Cloud With the Ultra Low Latency API (Video Tutorial)

July 16, 2018 by

If you’re building an app or service that demands real-time streaming delivery—such as those for gaming, financial trading or interactive experiences like HQ Trivia—you need an API that’s built for speed. The Wowza Streaming Cloud™ service with Ultra Low Latency offers sub-three-second end-to-end streaming delivery, and it’s easily accessible through the API.

By creating Ultra Low Latency Stream Targets through the API, you can send live streams to destinations around the world. The goal is to minimize the time it takes to display a live video from glass to glass (that is, from the glass of the recording device glass to the glass of the end viewer’s screen).

Watch this video and see how easy it is to get started using the Wowza Streaming Cloud with Ultra Low Latency API:

Tools Used:

Step-by-Step Tutorial:

1. The most conventional method for describing REST calls is to use cURL. Go to the sandbox to get the sample API cURL command; copy the command; and rename the URL. Scroll down on the left side and select Stream Targets, then Create an Ultra Low Latency Stream Target. Then, on the right, select Shell and copy off the command.

2. Replace “api-sandbox.cloud.wowza.com” with “api.cloud.wowza.com.” Now your cURL command will look like this:

// Using cURL

curl -H “wsc-api-key: a726c273…”

-H “wsc-access-key: 68289d8d…”

-H “Content-Type: application/json”

-X “POST” “https://api.cloud.wowza.com/api/v1.2/stream_targets/ull”

-d $'{

“ull_stream_target”: {

“property”: “My Value”,

“…”: “…”

}

}’

3. Go to https://cloud.wowza.com and sign in after establishing your Wowza Streaming Cloud account.

4. On the upper-right corner, click on your name, and the drop-down will appear. Select API Access.

5. Copy off this API key:

6. Add an Access Key, give it a description and save:

7. Copy the Access Key and the description.

8. You can run this cURL command from the Terminal app on your Mac (after installing CURL). We need to add the API Key; the Access Key; the name of the Stream; and the source delivery method. Your cURL command should look like this:

curl -H “wsc-api-key: your-API-key-here

-H “wsc-access-key: your-access-key-here

-H “Content-Type: application/json”

-X “POST” “https://api.cloud.wowza.com/api/v1.2/stream_targets/ull”

-d $'{

“ull_stream_target”: {

“name”: “your description“,

“source_delivery_method”: “push”

}

}’

 

9. Paste and execute in Terminal and see the results, including the connection code:

10. Optional: Instead of cURL, you can also use any API testing tool, such as Postman, which is free, and runs on Windows, Mac or Linux platforms. It provides a better-formatted response. Another option is to copy out the cURLurl response and put it into a JSON “Prettifier.”

11. Set the authentication desired using the Post for this URL: https://api.cloud.wowza.com/api/v1.2/stream_targets/ull

12. Set the header keys with the wsc-api-key and wsc-access-key and the Content_Type to application/json:

13. Set the body as Raw, with this payload containing information for the ull_stream_target, and hit Send to see the response:

{

“ull_stream_target”: {

“name”: “Russ Demo”,

“source_delivery_method”: “push”

}

}

14. Copy the connection_code.

15. Verify that this worked and that you created a Stream Target. Bring up the Wowza Streaming Cloud web manager again, click on Advanced and select Stream Targets.

16. Select the target you just created, and note that it says Ultra Low Latency in the Type column.

17. Click on the Stream Target and confirm the connection code you saw in your response. 18. Click on the Wowza Ultra Low Latency Test Player.

19. If you haven’t already, download GoCoder, and then start the app on your Android or iOS device. 20. Click on the GoCoder settings widget (the gear icon) in the upper-right corner:

21. In the settings menu, select Connect To and Wowza Streaming Cloud, then paste the connection code and click Done. You should see a status update that the settings were saved successfully.

22. Back on the recording screen, press the red “recordpublish/encode” button. 23. Go back to the Player, and you should see the near-immediate response: from the glass on your recording device to the glass on your playback device! Amazing, huh?

24. Optional: Let’s create a website with the Wowza Player in Visual Studio 2017 using the code snippets from the Wowza Player Embed. 25. In the File menu, select New and Project.

26. In the Visual C# menu, select Web and then ASP.NET Web Application, and call it “MyWowzaPlayer.”

27. Select an Empty site.

28. Right-click on Project, select Add and then HTML Page.

29. Call the page “Index.”

30. Back on the Player page, Click on the Get Embed Code button, and you’ll see the code to add the Wowza Player to any HTML page or web view in an app:

31. Copy as instructed into the Head and Body sections:

32. Paste into Index.html, and it should look similar to this:

33. Run the API call, and you should now see the stream playing on both the test player and your website at the same time! You may have to run the API call one more time to get a new code to enter in your GoCoder app if the streaming doesn’t work for you.

Instead of running a call to create an entirely new ultra low latency stream target, you can also run an API call to regenerate the connection code. See this API call: https://sandbox.cloud.wowza.com/api/current/docs#operation/regenerateConnectionCodeStreamTarget.

Alternatively, you can regenerate a code in the Wowza Streaming Cloud web manager when you’re on the ultra low latency stream’s details page.

Having fun yet? Check out more API calls at: https://sandbox.cloud.wowza.com/api/current/docs#tag/stream_targets

Happy coding!

Additional Resources:

Wowza Streaming Cloud with Ultra Low Latency Quick Start Guide

How to Use Wowza Streaming Cloud for Ultra Low Latency Streaming

Ultra Low Latency Examples

Follow us on Twitter: @WowzaDev