I’m creating a scheduler that can start a live stream at a defined date/time. Using the ServerListenerStreamPublisher as a starting point, I use the following code to create the playlist and start playing:
private class StreamListener implements IStreamActionNotify {
@Override
public void onPlaylistItemStart(Stream stream, PlaylistItem playlistItem) {
WMSLoggerFactory.getLogger(null).info("PlaylistItem started");
}
@Override
public void onPlaylistItemStop(Stream stream, PlaylistItem playlistItem) {
WMSLoggerFactory.getLogger(null).info("PlaylistItem stopped");
}
}
Stream stream = Stream.createInstance(appInstance, streamname);
stream.addListener( new StreamListener() );
Playlist playlist = new Playlist("mytest");
playlist.addItem("udp://127.0.0.1:1234", -2, 3600);
playlist.open(stream);
As you can see, I’m trying to play this live stream for exactly one hour. To my surprise, I see that the StreamListener.onPlaylistItemStart and StreamListener.onPlaylistItemStop get called directly after each other. This happens only when the source is a live stream (I also tried with a .stream file, same result) - when I try it with sample.mp4, it works as expected.
My intention is to use the startMediaCasterStream/stopMediaCasterStream inside onPlaylistItemStart/onPlaylistItemStop
Is this behavior as designed?