Wowza Community

Whats wrong with the Java Code

Hello wowza team, first of all I’d like to thank the awesome assistance of the sales representatives . I am developing an android application, its a social platform where people can meet and chat. We have video streaming feature in the application and so we are using the WOWZA REST API. I am using the below code to get create a live video steam.

String url = “”;

URL uri = new URL(url);

HttpsURLConnection conn = (HttpsURLConnection) uri.openConnection();


conn.setRequestProperty(“Content-Type”, “application/json; charset=UTF-8”);

conn.setRequestProperty(“wsc-api-key”, API_KEY);

conn.setRequestProperty(“wsc-access-key”, API_ACCESS_KEY);




JSONObject body = new JSONObject();

body.put(“name”, name).put(“transcoder_type”, “transcoded”).put(“billing_mode”, “pay_as_you_go”)

.put(“broadcast_location”, “asia_pacific_singapore”).put(“encoder”, “other_rtsp”)

.put(“delivery_method”, “pull”).put(“source_url”, sourceUrl).put(“aspect_ratio_width”, “1280”)

.put(“aspect_ratio_height”, “720”);

JSONObject jsonObject = new JSONObject();

jsonObject.put(“live_stream”, body);

byte[] outputBytes = jsonObject.toString().getBytes(“UTF-8”);

OutputStream os = conn.getOutputStream();



InputStream in = conn.getInputStream();

String result = IOUtils.toString(in, “UTF-8”);

Log.i(TAG, "Response : "+ result);



wowzaResponse = new Gson().fromJson(result, WowzaResponse.class);

I am getting the following error, it would be really helpful the community can help me identify the error and help me with the integration process.

“” on the line “InputStream in = conn.getInputStream();”

Hello there and welcome to the Wowza support forum. Troubleshooting custom code is a bit beyond the scope of this forum.

But as for your current error, is it possible the server was unavailable at the time of execution? Are you still getting the error?

You may wish to consider hiring the help of a Wowza endorsed consultant to assist you in this development. If so please post a request to the find a consultant forum.