Hi,
If ffplay is making a normal rtmp request and you can play the full url back then you should be able to do the following.
Your module will need to implement the IStreamNameAliasProvider interface. This will provide 2 methods, resolvePlayAlias & resolveStreamAlias. resolvePlayAlias is the one you will be using to re-map the stream name. resolveStreamAlias will not be called for vod but you should return the input name for completeness.
Override ModuleCore.play. This is where the play command from the player will be received. Here you will convert your start & duration url variables into parameters to pass to the ModuleCore.play method.
Your queryString parameters should be available in client.getQueryStr().
The params field contains the initial settings.
PARAM1 is the stream name. You could re-map it here but it is better to do that using the resolvePlayAlias method.
PARAM2 is the start time in milliseconds.
PARAM3 is the duration in milliseconds.
PARAM4 is reset. With a custom flash client, it is possible to call play multiple times to create a playlist which will switch seamlessly. reset is used to reset the playlist. It most likely will not work with ffplay as it probably cannot handle the multiple play requests.
You should also create a custom MediaReader to override MediaReaderFLV or MediaReaderH264 to set the metadata duration to the modified duration.
Call invokePrevious passing your modified params AMFDataList to invoke the ModuleCore.play method. If play is being overridden in any other modules between yours and ModuleCore then these will be invoked first. None of the std modules invoke this method. You can see what methods each module invokes when you have debug logging enabled.
If you implement IStreamNameAliasProvider then in resolvePlayAlias, return the full path to the vod file. This will be called from ModuleCore.play for every stream.
https://www.wowza.com/docs/how-to-insert-a-pre-roll-or-mid-roll-for-video-on-demand-playback-in-flash-rtmp-client shows how to invoke play to modify params and also create a custom Mediareader to handle the modified duration.
You may also need to have a custom getStreamLength method for the player to call. Some players call this before play to get the duration (JW Player).
public void getStreamLength(IClient client, RequestFunction function, AMFDataList params) {
double duration = calculate duration from QueryString;
sendResult(client, params, duration);
}
Hope this helps.
Roger.