/**
 * Copyright (c) 2006 - 2008 Smaxe Ltd (www.smaxe.com).
 * All rights reserved.
 */

import com.smaxe.app.uv.downloader.RtmpDownloader;

import java.util.concurrent.Future;

/**
 * <code>ExRtmpDownloader</code> - {@link RtmpDownloader} usage example.
 * 
 * @author Andrei Sochirca
 */
public final class ExRtmpDownloader extends Object
{
    /**
     * Entry point.
     * 
     * @param args arguments
     * @throws Exception if an exception occurred
     */
    public static void main(final String[] args) throws Exception
    {
        RtmpDownloader downloader = new RtmpDownloader();
        
        downloader.setDebugMode(true);
        
        final Future<Boolean> future = downloader.download("rtmp://localhost:1935/live",
                null /*connection arguments*/,
                null /*connection configuration*/, 
                "stream",
                "stream.flv" /*local flv file*/);
        
        while (!future.isDone())
        {
            Thread.sleep(1000);
            
            System.out.println("... downloading ...");
        }
        
        System.out.println("Download state: " + future.get());
    }
    
    /**
     * Constructor.
     */
    private ExRtmpDownloader()
    {
    }
}