Search code examples
javastreamaliasred5

Red5 create stream name alias at runtime


I would like to create alias names for locally stored video files at runtime. For example, I have a "test/video.flv" file and I create a "abc123" alias (or "abc123.flv" if the extension matters).

I would like to use these aliases for unique and disposable video path. So I need to remove them after 1 use.

  • How to create the alias at runtime?
  • How to remove it at runtime?

Solution

  • You have multiple options to realize that:

    One way is to create a symbolic link, so you would use the underlaying operating system to fool red5 that there is a file existing. You will then have to add Listeners in your ApplicationAdapter to listen to the needed events. For example: http://dl.fancycode.com/red5/api/org/red5/server/adapter/ApplicationAdapter.html => streamStart/stop et cetera. You have to lookup the ApplicationAdapter of your Red5 version to see all possible events that you can listen in the Red5 version that you are using!

    The second solution would be to write a custom stream Handler. However this would need further investigation. I don't think that there is a standard mechanism to modify the file request to apply some kind of wildcard to it. It would work similar to the first solution, but you would need to rewrite/overwrite some of the mechanisms of the ApplicationAdapter to that process file requests.

    So basically the best thing would be to study your ApplicationAdapter and find the event listeners you are looking for.