Browse files

Updated web app context path to be dynamic.

  • Loading branch information...
Andy--S committed Dec 17, 2015
1 parent 6ef3980 commit 9c7e751d07e27159c876a5c8642b75b028c558d6
Showing with 28 additions and 3 deletions.
  1. +28 −3 FileConversion/src/com/infrared5/red5pro/live/
@@ -21,7 +21,7 @@
* Application life-cycle begins here
public boolean appStart(IScope scope){"Red5 Pro File conversion Demo");
//Return false to prevent app from starting for any reason
return true;
@@ -36,6 +36,8 @@ public void streamBroadcastClose(IBroadcastStream stream){
final String name = stream.getPublishedName();
final String theFlv = stream.getSaveFilename();
final IScope fileScope = stream.getScope();
final String path = fileScope.getContextPath();"path {}",path);
new Thread(new Runnable(){
@@ -56,9 +58,32 @@ public void run() {
try {//Get the path for command line.
//the recorded file location
String inputLocation= "PATH_TO_RED5_ROOT/webapps/live/streams/";
//Where is this happening?
String where=fileScope.getContextPath();
//Remove leading slash
//break it down to rooms and remove the separator.
String[] paths = where.split("/");
//grab the app name from the context.
String appName = paths[0];"paths length {}",paths.length);
//Form the file input location with the app name and streams directory.
String inputLocation= "PATH_TO_RED5_ROOT/webapps/"+appName+"/streams/";
//Add the rooms path if there is one.
for( int i=1;i<paths.length;i++){
//Add the file name to complete the path.
String filePath= inputLocation+name+".flv";//or use 'theFlv'
String outputLocation = "PATH_TO_RED5_ROOT/webapps/live/";
//Form the output path.
String outputLocation = "PATH_TO_RED5_ROOT/webapps/"+appName+"/";
//Here you could potentially recreate the context structure of the rooms that we parsed above.
//add the room names back onto the path and call makdirs.
//File checker = new File(outputLocation);
//checker.mkdirs()"Recorded file {}",filePath);
String outputFile = outputLocation + name +".mp4";
//delete any previous file created, or ffmpeg will complain.

0 comments on commit 9c7e751

Please sign in to comment.