• How to use IMediaWriterActionNotify to programmatically move and rename recordings of live streams

    You can use the IMediaWriterActionNotify listener interface to be notified when file writes are completed. Listeners are added to an application instance using the IApplicationInstance.addMediaWriterListener(IMediaWriterActionNotify listener) method. Below is a module for that illustrates how to use this interface.

    Note: You can use the built-in ModuleMediaWriterFileMover module as a simpler alternative for copying or moving files after recording.

    package com.wowza.wms.plugin.test.module;
    
    import java.io.*; 
    import java.util.*;
    
    import com.wowza.wms.application.*;
    import com.wowza.wms.module.*;
    import com.wowza.wms.stream.*;
    
    public class ModuleWriteListener extends ModuleBase
    {
    	class WriteListener implements IMediaWriterActionNotify
    	{
    		public void onFLVAddMetadata(IMediaStream stream, Map<String, Object> extraMetadata)
    		{
    			getLogger().info("ModuleWriteListener.onFLVAddMetadata["+stream.getContextStr()+"]");
    		}
    
    		public void onWriteComplete(IMediaStream stream, File file)
    		{
    			getLogger().info("ModuleWriteListener.onWriteComplete["+stream.getContextStr()+"]: "+file);
    		}
    	}
    	
    	public void onAppStart(IApplicationInstance appInstance)
    	{
    		appInstance.addMediaWriterListener(new WriteListener());
    	}
    }


    If you're having problems or want to discuss this article, post in our forum.