HLS live streams loop forever?

Wowza Streaming Engine 4.5.0

Inside of a live stream application module, I’m doing this:

Stream stream = Stream.createInstance(thisInstance,"video");
stream.play(fileName,0,-1,false);	

This will start streaming a video to the “video” channel of my application.

However, this stream does not stop at the end of the video. It just loops over again at the beginning, despite that “false” there at the end, which should be telling it not to repeat.

Is there any way I can get this stream to automatically close at the end of the video? Right now I’m doing a workaround where I’m sending the “duration” as a query parameter, and then using that as a timer to close the stream, but this isn’t very accurate, currently.

The logs say:

INFO stream play video -
...
INFO server comment - onPlaylistItemStop: video
INFO server comment - Stream.switch[live/_definst_/video]: index: 0 name:small.mp4 start:0 length:-1
INFO server comment - onPlaylistItemStart: video
...
INFO server comment - onPlaylistItemStop: video
INFO server comment - Stream.switch[live/_definst_/video]: index: 0 name:small.mp4 start:0 length:-1
INFO server comment - onPlaylistItemStart: video
...

Apparently, I’m misunderstanding how stream.play() works. The documentation says that this only adds an item to the playlist. I still have to control the playlist through other means.

Calling stream.close() on IStreamActionNotify onPlaylistItemStop works