I'm wondering how to detect the failure of a mediacaster stream while it's being played, or even just the failure to connect up initially. I've tried the "addMediaCasterListener" method on the application object, but nothing catches it. I can see in the logs this:
The first line is from the class I'm using to detect connections etc for the listener, the second is from some internal class I guess. As you can see, the connection success is firing but the HTTP response is 404.. How do I grab that?
More importantly though, I need to know when a mediacaster stream fails part way through. Any ideas?
One option would be to check the streams last packet to see if there is an associated timecode. You could do this twice (~200ms apart) and compare the timecodes. You can check the timecode similar to the following:
// Example only
IApplication app = vhost.getApplication("live");
IApplicationInstance instance = app.getAppInstance("_definst_");
IMediaStream stream = instance.getStreams().getStream("myStream");
if (stream != null && stream.getLastPacket() != null)
if (stream.getLastPacket().getAbsTimecode() > 0)
// looks like stream is valid