stream.setBroadcastStreamPublishName(name);
stream.start();
created = true;
}
if (stream != null && stream instanceof ISubscriberStream) {
ISubscriberStream subscriberStream = (ISubscriberStream) stream;
IPlayItem item = simplePlayback.get() ? SimplePlayItem.build(name, start, length) : DynamicPlayItem.build(name, start, length);
if (subscriberStream instanceof IPlaylistSubscriberStream) {
IPlaylistSubscriberStream playlistStream = (IPlaylistSubscriberStream) subscriberStream;
if (flushPlaylist) {
playlistStream.removeAllItems();
}
playlistStream.addItem(item);
} else if (subscriberStream instanceof ISingleItemSubscriberStream) {
ISingleItemSubscriberStream singleStream = (ISingleItemSubscriberStream) subscriberStream;
singleStream.setPlayItem(item);
} else {
// not supported by this stream service
log.warn("Stream instance type: {} is not supported", subscriberStream.getClass().getName());
return;
}
try {
subscriberStream.play();
} catch (IOException err) {
if (created) {
stream.close();
streamConn.deleteStreamById(streamId);
}