Wowza Community

Detect File/Stream Not Found for HTTP Streamers

May be somewhat verbose, but trying to hit all the things I’ve tried and maybe it’ll be useful to someone in the future. I’m looking for some event/mechanism/way to signal successfully started http streamer sessions in a module. Successful meaning anything that has the potential to serve 1 segment (actually exists), somewhat equivalent to the “play” event in flash/rtmp. Up until that point of the “play” the connection hasn’t failed. Usually this is easily done by just handling the not found case, but there doesn’t seem to even be a way to programatically handle bad stream/filenames, especially the http streamers.

Specifically I’m interested in Cupertino/HLS but is there anyway to discern if an IHTTPStreamerSession attempts to open a non-existent file/stream for any of the streamers? SanJose/Cupertino/Smooth/MpegDash?

I’m doing this for analytics for all stream types. For RTMP streams this seems to be somewhat easy as I’m not interested in the plain RTMP connection, only a successful play event. So all I have to do is wait on the IMediaStreamActionNotify.onPlay method to get hit and assume anything else is an invalid connection/invalid stream/file (this is one of the unfortunate things…I have to assume over 9000 times and hope that’s how it actually works). RTP was a little bit trickier and I’m unsure if you’d consider this a bug. For VOD content and RTSP playback the IMediaStreamActionNotify.onPlay is always notified regardless of if the file exists or not. Why should onPlay get called if the file doesn’t exist? You don’t do that for RTMP, why do it for RTSP? Note the onPlay is also called in IRTSPActionNotify, so I’m guessing because onPlay is called in that interface the same is done for IMediaStreamActionNotify? Just seems weird.

For live streams using RTSP playback nothing in IMediaStreamActionNotify (or IRTSPActionNotify) will fire if stream doesn’t exist (sort of why it seems like a bug). For VOD though because I couldn’t reliably use the IMediaStreamActionNotify.onPlay event I also use the IMediaReaderActionNotify interface. Here I’m assuming that if the onMediaReaderOpen method never gets called there was a problem somewhere along the lines of playing the stream (which is fine I don’t care about problematic plays) or there was specifically an exception thrown attempting to open a file that doesn’t exist. As I can see in the wowza log the exception is always being thrown in the IMediaReader when it attempts to call open() when playing a file that doesn’t exist.

So that handles RTMP/RTSP…but what about HTTP and friends. Since there really is no “play” idea at all in http streaming that gets a little more difficult. As I can’t personally catch the exception thrown by the IMediaReader since another class wrapping that already catches and swallows the exception I’m guessing. I think for VOD I can still use IMediaReaderActionNotify and determine that if onMediaReaderOpen isn’t called, the file doesn’t exist. However I see no solution at all for LIVE cupertino and friends. Are there any other Notifier classes maybe I’m missing? Or undocumented tricks to handle the HTTP stuff?

All I’ll see happen in turns of events for a non-existant live stream



Then I’ll see in the logs HTTPStreamerAdapterCupertinoStreamer.onPlaylist reporting an error opening the stream. And after a sizeable timeout (I assume the server is waiting for the client to ask for more segments, and if it doesn’t then disconnection logic follows) finally ending with the two interfaces. Unsure of the order since it seems to happen asynchronously later, it seems the stream is destroyed prior to the http session though.



But with no discernable way of knowing there was an error. So again either looking for some event that only happens on successful http “plays”, or some way to catch/detect a failed play.

Actually using IMediaReader with HTTP vod streams is still somewhat problematic, as the create/init/open methods get called 2-3 times when a stream starts. Can be handled, but just becoming weirder and weirder.

Further addendum, it’s really JUST live Cupertino that results in different behavior. For SanJose, Smooth, and MpegDash if you attempt to play a live stream that does not exist the IHTTPSessionNotify.notifyHTTPSessionCreate never even fires, so they work beautifully. In exactly the same manner that Rtmp/Rtsp work for live. But for whatever reason for Cupertino the connection continues, and sort of makes it impossible to distinguish successful from failed plays. Why is this?