Hi Richard,
I am experiencing some troubles making it work. My goal is to insert an ad at the beginning of a requested video.
So here is my code:
String stream_name = params.getString(PARAM1);
System.out.println("Inserting ad for stream: " + stream_name);
AMFDataList custom_data_list = new AMFDataList();
// The ad
custom_data_list.add("play");
custom_data_list.add(0.0);
custom_data_list.add("null");
custom_data_list.add("mp4:/uploads/medias/advert.mp4");
custom_data_list.add(new AMFDataItem(0)); // start
custom_data_list.add(new AMFDataItem(20)); //duration
custom_data_list.add(new AMFDataItem(true)); //reset
invokePrevious(this, client, function, custom_data_list);
// The movie
custom_data_list.set(PARAM1, new AMFDataItem(stream_name));
custom_data_list.set(PARAM2, new AMFDataItem(0));
custom_data_list.set(PARAM3, new AMFDataItem(-1));
custom_data_list.set(PARAM4, new AMFDataItem(false));
invokePrevious(this, client, function, custom_data_list);
The problem is that my ad does not play, the movie immediately plays.
If I remove the movie section, the ad alone plays.
Can you explain a little what the options are for, I don’t really understand the physics here.
Thanks
EDIT: by the way I also implemented IMediaStreamFileMapper#streamFileForRead, maybe that’s why the movie immediately starts playing?
EDIT2: is it possible to prevent users from scrubbing the timeline while watching the ad?
EDIT3: actually for my ad to play, I must specify a duration of -1 otherwise it will not play at all (even when defined alone with no movie following), why is that? Why can you define a duration and not me???
EDIT4: Richard is your system compatible with a player like Flowplayer? Or should I code my own player? I suspect Flowplayer to stop playing after the ad is finished, so it doesn’t move on to the movie that follows.
EDIT5: ok I got it working in Flowplayer, one must set the live option to true so that it carries on.