Wowza Community

Play playlist item by name

I’ve created an HTTPProvider than creates and manages server-side playlists and streams. I can play a playlist item by index, but I couldn’t find a way to play it by name. Is there a method available?

Currently, I have this method that plays by index.

public void switchPlaylistItem(IApplicationInstance app, String streamName, Integer index) {
		Stream stream = (Stream)app.getProperties().getProperty(streamName);;

Here is what my current playlist object looks like:

[{PlaylistItem: index: 0,name: "livestream",start: -2,length: -1}, {PlaylistItem: index: 1,name: "sample.mp4",start: 0,length: -1}]

Thanks in advance.


Figured it out. I had to loop through the playlist items and check for the existence of a playlistitem object with that name. If so, then return the index of the object and then play that index. Here is sample code:

int index = -1;
List<PlaylistItem> items = playlist.getItems();
		for (int i = 0; i < items.size(); i++) {
				index = items.get(i).getIndex();