static void Main(string[] args)
        {
            // Create an instance of SWFToVideo ActiveX object
            SWFToVideo converter = new SWFToVideo();

            // Set debug log
            //converter.SetLogFile("log.txt");

            // Register SWFToVideo
            converter.RegistrationName = "demo";
            converter.RegistrationKey  = "demo";

            // Enable trasparency - BEFORE setting input file
            converter.RGBAMode = true;

            // set input SWF file
            converter.InputSWFFileName = "circles.swf";


            // Select 20th frame
            converter.StartFrame = 20;
            converter.StopFrame  = 20;

            // Run conversion
            converter.ConvertToPNG("result.png");

            // Open the result in default application
            Process.Start("result.png");
        }
        static void Main(string[] args)
        {
            // Create an instance of SWFToVideo ActiveX object
            SWFToVideo converter = new SWFToVideo();

            // Set debug log
            //converter.SetLogFile("log.txt");

            // Register SWFToVideo
            converter.RegistrationName = "demo";
            converter.RegistrationKey  = "demo";

            // Enable trasparency - set BEFORE setting swf filename
            converter.RGBAMode = true;

            // set input SWF file
            converter.InputSWFFileName = "Shapes.swf";

            // Select 20th frame
            converter.StartFrame = 20;
            converter.StopFrame  = 20;

            // Run conversion
            converter.ConvertToPNG("result.png");

            // release resources
            System.Runtime.InteropServices.Marshal.ReleaseComObject(converter);
            converter = null;


            // Open the result in default application
            Process.Start("result.png");
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            // Create an instance of SWFToVideo ActiveX object
            SWFToVideo converter = new SWFToVideo();

            // Set debug log
            //converter.SetLogFile("log.txt");

            // Register SWFToVideo
            converter.RegistrationName = "demo";
            converter.RegistrationKey  = "demo";

            // Set the converter to the live data conversion mode
            // (it will fully load the embedded video stream before the conversion)
            converter.SWFConversionMode = SWFConversionModeType.SWFWithLiveData;

            // Add SWF file
            converter.InputSWFFileName = "http://bytescout.com/demo/swfscout_VideoSample.swf";

            // Enable trasparency
            converter.RGBAMode = true;

            // Select 20th frame
            converter.StartFrame = 20;
            converter.StopFrame  = 20;
            // Save it to file
            converter.ConvertToPNG("frame20.png");

            // Select 50th frame
            converter.StartFrame = 50;
            converter.StopFrame  = 50;
            // Save it to file
            converter.ConvertToPNG("frame50.png");

            // release resources
            System.Runtime.InteropServices.Marshal.ReleaseComObject(converter);
            converter = null;


            // Open the result in default media player
            Process.Start("frame20.png");
        }
Beispiel #4
0
        /*
         * IF YOU SEE TEMPORARY FOLDER ACCESS ERRORS:
         *
         * Temporary folder access is required for web application when you use ByteScout SDK in it.
         * If you are getting errors related to the access to temporary folder like "Access to the path 'C:\Windows\TEMP\... is denied" then you need to add permission for this temporary folder to make ByteScout SDK working on that machine and IIS configuration because ByteScout SDK requires access to temp folder to cache some of its data for more efficient work.
         *
         * SOLUTION:
         *
         * If your IIS Application Pool has "Load User Profile" option enabled the IIS provides access to user's temp folder. Check user's temporary folder
         *
         * If you are running Web Application under an impersonated account or IIS_IUSRS group, IIS may redirect all requests into separate temp folder like "c:\temp\".
         *
         * In this case
         * - check the User or User Group your web application is running under
         * - then add permissions for this User or User Group to read and write into that temp folder (c:\temp or c:\windows\temp\ folder)
         * - restart your web application and try again
         *
         */

        protected void Page_Load(object sender, EventArgs e)
        {
            String inputSwfFile = Server.MapPath("Shapes.swf");

            // Create an instance of SWFToVideo ActiveX object
            SWFToVideo converter = new SWFToVideo();

            // Set debug log
            //converter.SetLogFile("log.txt");

            // Register SWFToVideo
            converter.RegistrationName = "demo";
            converter.RegistrationKey  = "demo";


            // Enable trasparency - set BEFORE setting SWF filename
            converter.RGBAMode = true;

            // set input SWF file
            converter.InputSWFFileName = inputSwfFile;


            // Select the frame to extract (20th)
            converter.StartFrame = 20;
            converter.StopFrame  = 20;

            // Run conversion.
            // Empty parameter means conversion to binary stream instead of file.
            converter.ConvertToPNG("");

            // release resources
            System.Runtime.InteropServices.Marshal.ReleaseComObject(converter);
            converter = null;


            // Display the extracted image:

            Response.Clear();
            // Add content type header
            Response.ContentType = "image/png";
            // Set the content disposition
            Response.AddHeader("Content-Disposition", "inline;filename=result.png");

            // Write the image bytes into the Response output stream
            Response.BinaryWrite((byte[])converter.BinaryImage);

            Response.End();
        }
        static void Main(string[] args)
        {
            // Create an instance of SWFToVideo ActiveX object
            SWFToVideo converter = new SWFToVideo();

            // Set debug log
            //converter.SetLogFile("log.txt");

            // Register SWFToVideo
            converter.RegistrationName = "demo";
            converter.RegistrationKey  = "demo";

            // Enable trasparency - set BEFORE setting swf filename
            converter.RGBAMode = true;

            // set input SWF file
            converter.InputSWFFileName = "Shapes.swf";

            // you may calculate output video duration using information about the the source swf movie
            // WARNING #1: this method to calculate the output video duration is not working for movies with dynamic scenes
            // and interactive scripts as in these movies it is not possible to calculate the precise duration of the movie
            // WARNING #2: you should set the input swf or flv filename (or url) before this calculation

            // So the movie duration is calculated as the following:
            // as swf frame count (number of frames in the swf) / movieFPS (frames per second defined in swf)
            // and then multiplied by 1000 (as we are setting the .ConverstionTimeout in milliseconds)
            // as the following (uncomment if you want to set the length of the output video to the same as the original swf)
            // or as the following source code (uncomment to enable):

            // converter.ConversionTimeout = 1000 * (converter.FrameCount / converter.MovieFPS)


            // Select 20th frame
            converter.StartFrame = 20;
            converter.StopFrame  = 20;

            // Run conversion
            converter.ConvertToPNG("result.png");

            // release resources
            System.Runtime.InteropServices.Marshal.ReleaseComObject(converter);
            converter = null;


            // Open the result in default application
            Process.Start("result.png");
        }
        static void Main(string[] args)
        {
            // Create an instance of SWFToVideo ActiveX object
            SWFToVideo converter = new SWFToVideo();

            // Set debug log
            //converter.SetLogFile("log.txt");

            // Register SWFToVideo
            converter.RegistrationName = "demo";
            converter.RegistrationKey  = "demo";

            // Set a value for the variable
            // (!) You should call SetVariable() before SetMovie()
            converter.SetVariable("Variable1", "hi this is passed variable");

            // Enable trasparency - BEFORE setting input SWF file
            converter.RGBAMode = true;

            // set input SWF file
            converter.InputSWFFileName = "MovieDisplayPassedVar.swf";

            // Select first frame
            converter.StartFrame = 0;
            converter.StopFrame  = 0;

            // Run conversion
            converter.ConvertToPNG("result.png");

            // release resources
            System.Runtime.InteropServices.Marshal.ReleaseComObject(converter);
            converter = null;


            // Open the result in default application
            Process.Start("result.png");
        }