} finally {
// clean up
simplePlayback.remove();
}
} else if ("append".equals(transition) || "appendAndWait".equals(transition)) {
IPlaylistSubscriberStream playlistStream = (IPlaylistSubscriberStream) streamConn.getStreamById(streamId);
IPlayItem item = SimplePlayItem.build(streamName);
playlistStream.addItem(item);
if ("append".equals(transition)) {
play(streamName, start, length, false);
}
} else if ("swap".equals(transition)) {
IPlaylistSubscriberStream playlistStream = (IPlaylistSubscriberStream) streamConn.getStreamById(streamId);
IPlayItem item = SimplePlayItem.build(streamName);
int itemCount = playlistStream.getItemSize();
for (int i = 0; i < itemCount; i++) {
IPlayItem tmpItem = playlistStream.getItem(i);
if (tmpItem.getName().equals(oldStreamName)) {
if (!playlistStream.replace(tmpItem, item)) {
log.warn("Playlist item replacement failed");
sendNSFailed(streamConn, StatusCodes.NS_PLAY_FAILED, "Playlist swap failed.", streamName, streamId);
}
break;
}