This sample source code demonstrates how to convert flash movie (.swf) into a video file (.AVI) in ASP.NET using Bytescout SWF To Video SDK.
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Drawing
Imports System.Diagnostics
Imports System.IO
Imports BytescoutSWFToVideoLib
Public Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim inputSwfFile As String = Server.MapPath("SlideShowWithEffects.swf")
Dim outputAviFile As String = Path.GetTempPath() & "result.avi"
' Create an instance of SWFToVideo ActiveX object
Dim converter As New SWFToVideo()
' Set debug log
'converter.SetLogFile("log.txt")
' Register SWFToVideo
converter.RegistrationName = "demo"
converter.RegistrationKey = "demo"
' Add SWF file and set its output filename
converter.SetMovie(inputSwfFile, outputAviFile)
' Set output movie dimensions
converter.OutputWidth = 640
converter.OutputHeight = 480
' Run conversion
converter.RunAndWait()
' Show filename of result file
Response.Clear()
Response.ContentType = "text/html"
Response.Write("Output file: <b>" & outputAviFile & "</b>")
Response.End()
End Sub
End Class
ASP.NET (C#), Default.aspx.cs:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Diagnostics;
using System.IO;
using BytescoutSWFToVideoLib;
namespace Simple
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String inputSwfFile = Server.MapPath("SlideShowWithEffects.swf");
String outputAviFile = Path.GetTempPath() + "result.avi";
// 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";
// Add SWF file and set its output filename
converter.SetMovie(inputSwfFile, outputAviFile);
// Set output movie dimensions
converter.OutputWidth = 640;
converter.OutputHeight = 480;
// Run conversion
converter.RunAndWait();
// Show filename of result file
Response.Clear();
Response.ContentType = "text/html";
Response.Write("Result video file: <b>" + outputAviFile + "</b>");
Response.End();
}
}
}