2

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?
haxpanel
  • 4,402
  • 4
  • 43
  • 71

2 Answers2

3

I've found a better solution for this! In the red5-web.xml file I added a bean <bean id="streamFilenameGenerator" class="myapp.FilenameGenerator"></bean> and created the class for it public class FilenameGenerator implements IStreamFilenameGenerator. Now I just needed to override the public String generateFilename(IScope scope, String name, GenerationType type) function that is responsible for the filename resolving. The name parameter is the requested stream name and the return value is the resolved one. From this point now this is simple, for example create a HashMap with key=alias name and value=real existing file path.

haxpanel
  • 4,402
  • 4
  • 43
  • 71
1

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.

seba.wagner
  • 3,800
  • 4
  • 28
  • 52