Results 1 to 2 of 2

Thread: Auto recording module

  1. #1
    Join Date
    Dec 2015
    Posts
    1

    Default Auto recording module

    Hi there,

    I have a Java class with this code:

    public class AutoRecordModule extends ModuleBase implements IModuleOnApp {
    	private IApplicationInstance appInstance = null;
    	private IVHost vhost = null;
    	
    	@Override
    	public void onAppStart(IApplicationInstance appInstance)
    	{
    		getLogger().info("ModuleAutoRecordCustom onAppStart["+appInstance.getContextStr()+"]: ");
    
         	this.appInstance = appInstance;
         	this.vhost = appInstance.getVHost();
         	
    		// set recording params as desired
    		StreamRecorderParameters recordParams = new StreamRecorderParameters(appInstance);
    
    	    // don't segment, using the default content path, do not append (i.e. overwrite if file exists)
    		recordParams.segmentationType = IStreamRecorderConstants.SEGMENT_NONE;
    		recordParams.versioningOption = IStreamRecorderConstants.APPEND_FILE;
    		recordParams.fileFormat = IStreamRecorderConstants.FORMAT_MP4;
    		recordParams.startOnKeyFrame =  true;
    		recordParams.recordData = true;
    		getLogger().info("--- startRecording");
    
    		// tell LiveStreamRecordManager to record all streams for this Instance using these params
    		vhost.getLiveStreamRecordManager().startRecording(appInstance, recordParams);
    	}
    
    	@Override
    	public void onAppStop(IApplicationInstance appInstance) {
    		// TODO Auto-generated method stub
    		
    	}
    }
    This code record all videos publiched on my app.

    But I have a really wrong thing, if a video stream is unpublish it and immediately a new streams with different name is publish, the recorder module append on the old file, I mean this new video is appending on the last video file recorded and not on a new file.

    Here I copy a couple of lines of my console log

    INFO server comment - MyStreamRecorderListener.onSegmentEnd[live/_definst_]: segment closed:testrecord2
    INFO server comment - MyStreamRecorderListener.onStopRecorder[live/_definst_]: Recording stopped:testrecord2 /usr/local/WowzaStreamingEngine/content/testrecord1.mp4


    Can you help me with this please?

    Thanks!

  2. #2
    Join Date
    May 2013
    Posts
    680

    Default

    Hello

    You might consider leveraging the functionality provided by the file version delegate:

    recordParams.fileVersionDelegate = new MyFileVersionDelegate();
    ...
    class MyFileVersionDelegate implements IStreamRecorderFileVersionDelegate
    {
    	.....
    }
    And further control using the IStreamRecorderActionNotify interface to specify stream specific parameters. You can take a look at the advanced recording module for a complete example.

    Thanks,
    Matt

Similar Threads

  1. Video Recording Auto Behaviour
    By dhamibirendra in forum General Forum
    Replies: 4
    Last Post: 09-25-2013, 09:46 AM
  2. Auto record module not working on EC2 AMI
    By briand123 in forum Server-side Modules and Code Samples Discussion
    Replies: 5
    Last Post: 12-10-2012, 10:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •