Hi everyone,
I’m having trouble getting a cuepoint message to send from an onPlay method override. The purpose of this is to send a message with information about the current slide being shown, if someone connects to the stream after a slide change has occurred. The idea was to have a cuepoint message containing all, relevant information about the slide, when onPlay is called, that way the newly joined participant gets the most recent slide information.
Needless to say, it isn’t working, and I can’t figure out why. I have similar code written as an HttpProvider which handles get requests and turns them into slide change messages, and sends them out as cuepoints, and this works just fine. But when I use almost exactly the same code in onPlay there is no message sent.
No errors are thrown, and the logger message on the line after the stream.sendDirect prints, and includes the correct information. The client player never receives the message.
Hoping someone with more experience than myself can help me out, or at least point me in the right direction.
public class EventManagerStreamNotifier extends ModuleBase {
public EventManagerStreamNotifier() {
}
public void onStreamCreate(IMediaStream stream) {
stream.addClientListener(new IMediaStreamActionNotify() {
@Override
public void onPlay(IMediaStream stream, String streamName, double arg2, double arg3, int arg4) {
String dateString = /*can't include this because it has company info in it*/
try {
BufferedReader buffRead = new BufferedReader(new FileReader(dirPath+"/"+streamName+"_"+dateString+"_slideLog.txt"));
String temp = null;
String message = null;
while((temp = buffRead.readLine())!=null) {
message = temp;
}
AMFDataMixedArray data = new AMFDataMixedArray();
data.put("message", new AMFDataItem(message));
AMFDataMixedArray parameters = new AMFDataMixedArray();
parameters.put("parameters", data);
parameters.put("time", new AMFDataItem(stream.getElapsedTime().getTime()));
stream.sendDirect("onCuePoint", parameters);
getLogger().info("Send onCuePoint Message with payload->" + parameters.toString());
} catch (Exception e) {
getLogger().error("Error in onPlay: "+e.toString());
}
}
});
}
}