Results 1 to 2 of 2

Thread: send cuepoint in onPlay method

  1. #1
    Join Date
    Jul 2015

    Default send cuepoint in onPlay method

    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() {
    			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());

  2. #2



    Normally, you would use the sendDirect method on the published stream and then it will send the request to all of the RTMP player streams. In this case, you are trying to use the sendDirect method on a player stream which is why it isn't working.

    To get a referent to the publisher stream from the onPlay method, you would have to do something like the following:

    IMediaStream publishStream = stream.getStreams().getStream(streamName);
    It's most likely that your HTTP Provider would have been using similar code to get the stream to send the messages to. getStream(streamName); will always return a published stream (or null).


Similar Threads

  1. Warning and error with cuepoint data injection
    By jachai in forum Live Streaming and Encoder Discussion
    Replies: 1
    Last Post: 09-28-2013, 04:31 AM
  2. osmf utcTime how CuePoint
    By pidboretskyy in forum AddOn: Wowza nDVR
    Replies: 1
    Last Post: 04-06-2012, 12:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts