So I have been looking for a way to get the 16 digit stream name from YouTube and i have finally found out how which is via this line of code ->
streamName = ret
Live broadcast is associated with a stream using a liveBroadcasts/bind method.
In terms of Java API it would look something like this:
YouTube yt = ... // your reference to YouTube
String broadcastId = ... // your broadcast Id
String newStreamId = ... // identifier of stream you want to bind
String apiKEy = ... // your API key
// you can define other response parts if you want more or don't want some of these
String responseParts = "id,status,contentDetails.boundStreamId";
yt.liveBroadcasts().bind(broadcastId, responseParts)
.setApiKey(apiKey)
.setStreamId(streamId)
// other data you might want in request
.execute()
API references: