streaming broadcast app for android

Posted by fierce at 2020-04-10

September 4, 2019 Fromlive commerceto e-gaming,live-streaming apps attract users across a range of industries. There’s no better way to engage users in 2019. But streaming can be complicated, even for experienced developers. In this video, Justin shows how to build a playback app using theGoCoder SDK for Android. This free tool simplifies mobile app development by offering a common, cross-platform API to capture, encode, and stream live video. Please reference our docsto follow the coding process. Justin Miller: Let’s look at how to build a basic live streaming broadcast app for Android using Android Studio, Wowza GoCoder SDK, and Wowza Streaming Cloud as our media server and content delivery network. From, you can get a free trial for Wowza Streaming Cloud and sign up for a free Wowza GoCoder SDK license. When signing up, be sure to use a reverse domain name for the application ID. Both Apple and Google prefer it. If you already have your license, you can download Wowza GoCoder SDK using the download link at the top, then selecting the Wowza GoCoder SDK tab. Once you’ve downloaded that installer for Android, be sure to unzip the file somewhere you’ll remember. Now, to start building, we’ll be using the Wowza documentation, build a live streaming app with GoCoder SDK for Android. Open Android Studio and start a new project. The project will use an empty activity. Name your project, then add your application ID as your package name. Make sure you know the location your project will be saved in, set the language to Java, and the API level to at least 21. Once you’re finished, your project will load in Android Studio. Now we’ll need to configure the project to use Wowza GoCoder SDK. Locate the unzipped Wowza GoCoder SDK directory. You’ll need to copy the .aar file. Then access where your Android is being saved. Under app, in the libs folder, paste the .aar file. This will make it easier to reference the SDK. In Android Studio, open build.gradlemoduleapp. From the install documentation, copy the code to locate the libs folder, and paste this before the dependencies. Then, back in the documentation, you’ll also want to copy the GoCoder SDK library dependency declaration and paste it into the dependencies. Once you’re done, you can sync the project. Now we can go to the manifest and, from here, we’ll add permissions from the install documentation to access the camera, record audio, internet, flashlight, and audio settings. Paste them above the application block. With the SDK configuration complete, we can start building the basic app by returning to the main documentation and adding a camera preview and broadcast button to the layout definition file. Copy the code, and then back in Android Studio, go to res and under layout, open activity_main.xml. Using the text tab, you’ll replace its contents by pasting in the new code. In order to hide the keyboard, we’ll go back to the documentation and copy the Android config changes property. Then returning to the AndroidManifest.xml file, we’ll paste over the activity element. Now we can enable Android’s immersive, sticky, fully screen mode by copying the code in the documentation, then heading over to the main activity class, and pasting it in before the last curly brace. You may see a few sections turn red. Use OptionReturn to connect them to their dependencies. Next, we’ll define app properties. To make them global, copy the code in the documentation and then paste them over the main activity. Again, we’ll need to use OptionReturn to build them in properly. Back in the documentation, we’ll continue by registering and initializing the SDK. The second to last part we’ll need to add is the broadcast monitoring callbacks. The first section will need to be added to the main activity class definition to monitor for status updates and errors during broadcast. In this one instance, we will not use OptionReturn for Wowza status call back. Back in the documentation, copy the defined methods, which will be pasted into the main activity class before the final curly brace. These will need quite a number of OptionReturns to build them in properly. Now we can add the last step to start streaming. Add the ViewOnClick.listener interface to the main activity class definition. Once this is pasted in, we can use OptionReturn to build in Wowza status call back. Then, back in the documentation, we’ll copy the code, add an onClick() event handler. This will be pasted into the bottom, before the last curly brace of the main activity class to be invoked when the Broadcast button is tapped. Use OptionReturn to build it in properly.

We’ll need to copy this information as our connection properties in Android Studio. While the primary server URL needs to be broken up into host address and application name, everything else should be easy to follow. In the future, you can use the API to pull this type of information from Wowza Streaming Cloud. Once you’re finished with these changes, you can deploy the build to a device with the minimum API level. Before you attempt to broadcast, you’ll need to go back into Wowza Streaming Cloud and Start Live Stream. Once the live stream has started and running, you can then test the app and verify its broadcasting. While you can view the live stream from a player or hosted page, you can also see it’s working from the video thumbnail, statistics, and health monitoring. When you’re finished, be sure to stop your live stream in Wowza Streaming Cloud. For more information on developing a broadcast app using Wowza GoCoder SDK, be sure to check out our additional documentation. Thanks for watching and happy streaming. About Traci Ruether