I am repurposing the loop until live code to setup the server stream on request, and when publishing switch to the live stream. I am able to subscribe with HLS immediate after the stream is setup. But when publishing , the HLS stream playback fails but fragments are downloading.
So in this part, is not switching for HLS, a refresh is required
List playlist = stream.getPlaylist();
PlaylistItem currentItem = stream.getCurrentItem();
int currentItemIndex = currentItem != null ? currentItem.getIndex() : 0;
playlists.put(outName, playlist);
playlistIndexes.put(outName, currentItemIndex);
stream.play(streamName, -2, -1, true);