ByteScout SWF To Video SDK - ASP.NET - SWF to PNG (C#) - ByteScout

ByteScout SWF To Video SDK – ASP.NET – SWF to PNG (C#)

  • Home
  • /
  • Articles
  • /
  • ByteScout SWF To Video SDK – ASP.NET – SWF to PNG (C#)

SWF to PNG (c#) in ASP.NET and ByteScout SWF To Video SDK

SWF to PNG (c#) in ASP.NET

Source code documentation samples provide quick and easy way to add a required functionality into your application. ByteScout SWF To Video SDK helps with SWF to PNG (c#) in ASP.NET. ByteScout SWF To Video SDK is the specialized software development kit for programmers who need to add SWF (Flash Macromedia) to video conversion into their app. Supports WMV and AVI video output with sound as can take input flash movies with variables, actionscripts, dynamic files as input. You can control output video size, framerate, video and audio quality.

You will save a lot of time on writing and testing code as you may just take the code below and use it in your application. This ASP.NET sample code should be copied and pasted into your application’s code editor. Then just compile and run it to see how it works. Enhanced documentation and tutorials are available along with installed ByteScout SWF To Video SDK if you’d like to dive deeper into the topic and the details of the API.

Our website provides free trial version of ByteScout SWF To Video SDK. It comes along with all these source code samples with the goal to help you with your ASP.NET application implementation.

Try ByteScout SWF To Video SDK today: Get 60 Day Free Trial or sign up for Web API

Default.aspx
      
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SwfToPng._Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> </div> </form> </body> </html>

Try ByteScout SWF To Video SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

Default.aspx.cs
      
// x64 IMPORTANT NOTE: set CPU to x86 to build in x86 mode. using System; using System.IO; using BytescoutSWFToVideo; namespace SwfToPng { public partial class _Default : System.Web.UI.Page { /* 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(); } } }

Try ByteScout SWF To Video SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

Default.aspx.designer.cs
      
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:2.0.50727.4927 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace SwfToPng { /// <summary> /// _Default class. /// </summary> /// <remarks> /// Auto-generated class. /// </remarks> public partial class _Default { /// <summary> /// form1 control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlForm form1; } }

Try ByteScout SWF To Video SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

README-FIRST-ASP-NET.txt
      
To use SWF To Video SDK on Web Server you may need to do the following adjustments to the server. Confirmed: SDK works on virtual Windows 2003, 2008, 2012 servers with these adjustments. 1) Windows Server 2003 or later: If you are using WMV format then install Windows Media Player from "Desktop Experience" 2) Update flash player for Internet Explorer to the latest version. To update do the following - run Internet Explorer - open adobe.com - click on Update Flash Player - follow the instruction and install the latest flash player plugin for Internet Explorer NOTE: on x64 Windows you should run Internet Explorer for x86 (not x64 version) 3) To convert interactive flash movies you should enable "allow interact with desktop" option IMPORTANT: this may cause security breaches so pleaase be careful! Recommended way: - create new IIS user - use it to run web application to convert swf to video only - set it to x86 mode only - set it to "allow desktop interaction" 4) For Windows 2008, 2012 or later: If you are on Windows Server 2008 or higher and you have set "allow desktop interaction" already but still having the issue please try the following solution as suggested by Microsoft specialists: Windows Server 2008, 2012 no longer allows interactive services, by default, which makes the Interactive Services Detection service unnecessary. http://social.technet.microsoft.com/Forums/en-US/winserver8gen/thread/6fb5693a-a256-41f7-a1df-d30101d9f8b6 if you must run a the application that installs an interactive service on Windows Server 2012, you may sacrifice server stability for compatibility by changing the following registry value from the default of "1" into "0": "NoInteractiveServices" in "HKLM\SYSTEM\CurrentControlSet\Control\Windows" After doing so and rebooting, the Interactive Services Detection Service will start. 5) for x64 windows: you should set IIS to run your web application in x86 mode 6) for x64 Windows: you should compile your ASP.NET web application for x86 platform instead of AnyCPU POSSIBLE ISSUES: 1) Flash movie with dynamic XML data shows "Can not load XML data". Solution: To check this issue try to run Internet Explorer on the server machine and open that flash movie (or URL to flash movie in Internet Explorer) 2) if you suspect the issue is caused by flash movie not properly running you may need to run it in Flash Player Debug version Solution: You should download "Windows Flash Player 11.7 ActiveX control content debugger (for IE)" from this page http://www.adobe.com/support/flashplayer/downloads.html Install, follow the instruction and try to open that flash movie in Internet Explorer again and flash player will display debug error messages from flash if needed 3) If your flash movie is designed to run on machines with sound card then you may experience issues related to the lack of audio devices. Solution: if you are able to recompile flash movie then add the additional check for sound devices presented/installed 4) If your XML or external is loaded from different domain/subdomain then data can be restricted by cross-domain policies in the latest flash versions Solution: make and upload cross-domain policy domain XML file to the domain(s) with the source data See http://kb2.adobe.com/cps/142/tn_14213.html http://www.adobe.com/devnet/adobe-media-server/articles/cross-domain-xml-for-streaming.html http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -- Updated June 11, 2013

Try ByteScout SWF To Video SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

README-FIRST.txt
      
Interact with desktop permission may be required to run Screen Capturing SDK or SWF To Video SDK from service or to convert interactive ("live") flash movies with SWF To Video SDK You may set this "Allow to interact with desktop" checkbox for the user that is used to run the service/app For IIS asp.net apps this user name is typically IIS_... user name Important note for Windows Server 2008 or later Newest Windows has disabled interactive services New Windows versions are no longer allowing to run interactive services by default to prevent services from accessing the desktop (to provide more security) If you must run a Screen Capturing SDK or SWF To Video SDK from an interactive service then you may sacrifice server stability for compatibility by changing the following registry value from the default of "1" to "0". HKLM\SYSTEM\CurrentControlSet\Control\Windows NoInteractiveServices Then reboot so Windows will pick the new value from the registry and the Interactive Services Detection Service will start. To make this change manually please do the following Start the registry editor (regedit.exe) in As Administrator mode Locate the following Registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows on the left side double-click the NoInteractiveServices entry on the right side and change its value from 1 to 0 Then click OK and close the registry editor Restart the computer

Try ByteScout SWF To Video SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

Web.config
      
<?xml version="1.0"?> <configuration> <appSettings/> <connectionStrings/> <system.web> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="true" /> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Windows" /> <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> </system.web> </configuration>

Try ByteScout SWF To Video SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

VIDEO

ON-PREMISE VERSION

Get 60 Day Free Trial or Visit ByteScout SWF To Video SDK page

Explore ByteScout SWF To Video SDK documentation

WEB API

Sign Up for free Web API key

Explore Web API Documentation

Tutorials:

prev
next