return;
}
}
}
IClientStream stream = streamConn.getStreamById(streamId);
boolean created = false;
if (stream == null) {
stream = streamConn.newPlaylistSubscriberStream(streamId);
stream.start();
created = true;
}
if (!(stream instanceof ISubscriberStream)) {
return;
}
ISubscriberStream subscriberStream = (ISubscriberStream) stream;
SimplePlayItem item = new SimplePlayItem();
item.setName(name);
item.setStart(start);
item.setLength(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
return;
}
try {
subscriberStream.play();
} catch (IOException err) {
if (created) {
stream.close();
streamConn.deleteStreamById(streamId);
}
sendNSFailed((RTMPConnection) streamConn, err.getMessage(), name, streamId);
}
}