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 = “https://api.cloud.wowza.com/api/v1/live_streams”;

URL uri = new URL(url);

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

conn.setConnectTimeout(5000);

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

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

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

conn.setDoOutput(true);

conn.setDoInput(true);

conn.setRequestMethod(“POST”);

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();

os.write(outputBytes);

os.close();

InputStream in = conn.getInputStream();

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

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

in.close();

conn.disconnect();

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.

“java.io.FileNotFoundException: https://api.cloud.wowza.com/api/v1/live_streams” 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.

Best,

Salvadore