Embedding Flash Player in a C++ or Java application? - c#

I would like to embed Flash Player directly inside a C++ or Java application.
I found an article that describes how to do this for C#:
http://www.adobe.com/devnet/flash/articles/stock_history03.html
Unfortunately, I have no experience with C#, COM or ActiveX. I need someone to translate this code to C++, allowing me to embed the Flash Player into a Win32 Window. Ultimately I'd like to use this information to embed Flash into a Java application.
I am looking for three main functionalities:
Ability to play a Flash movie
Ability to receive events (such as mouse clicks)
Ability to send events
Edit: I prefer an open-source solution if possible.

I don't know how to embed flash in C++, but Christopher Deckers (of SWTSwing fame) has developed an interesting hack which allows it to be embedded in Java. You can find more information in the Javalobby announcement thread.
Here is an updated link: https://github.com/Chrriis/DJ-Native-Swing

I gave the same answer not long ago. Check out SWHX:
http://haxe.org/com/libs/swhx
http://code.google.com/p/screenweaver-hx/
http://code.google.com/p/screenweaver-hx/source/browse/trunk/src/np_host.c
Cheers!
Juan

If it has to be open source I'd consider Gnash, an open source flash implementation.
It works on all major platforms, supports most multimedia codecs and is supposed to be embeddable in applications through nsapi.

If you want to go with a commercial solution, I'd recommend Scaleform GFx. It's not cheap, though, but it's damn good.

One simple way to create a Flash player in your window: AtlAxCreateControlEx.
To receive and send events, you will need a sink: AtlAdvise. You will need to define the functions receiving events on the ActionScript (i.e. Flash) side too.

What you should use is Netscape Plugin API. It's native and it's what all the good browsers use to load flash player plugin. While the actual flash player is not open source, this API is.
If you're not gonna ship a copy of flashplayer with your app:
Your app should check at runtime for flash player and should alert the user if it doesn't find it (usually by giving a link to Adobe to download it).
Flashplayer plugin is usually installed at %AppData%\Mozilla\plugins on Windows.

Take a look at FlashDX. It is open-source and free.

I personally haven't tried this but say in case of SWT/Java you could embed SWT browser window in you SWT/Java application and in the browser view you could put content with flash content, then communicate say with Merapi bridge with flash movie and java.

Related

A way to combine Adobe AIR with .NET?

I was wondering if there is a possibility to combine an AIR application with a WinForms Application?
Example
I've made some nice animated loading screens / splash screens with Adobe AIR and i want to use them with an .NET program, is that possible?
I don't want to simply call the program executable file (program.exe) within Adobe AIR (Air.exe). I want to use the textfields inside air, and as I click on Submit, I want AIR to pass the information to the .NET C# form and do stuff with that.
What is the proper way to do so, or what are alternative ways? (using WPF to embed a flash (SWF) inside .NET)
Based on the content posted in this tutorial, I think that it's possible to use .NET with Adobe AIR yet I'm not really sure.
You might also like to take a look at this which shows how to use CommandProxy to integrate AIR and .NET
Thanks,
I hope you find this helpful :)

Invoke Flash methods from C# (MONO)

Using .NET (Windows), you can embed an ActiveX Flash player into a Windows form, load a swf file and set variables or invoke functions with single method calls from C# (I imagine because of the presence of a Flash OCX).
That said, I would like to do the same thing in MONO (Linux): how could this be possible?
Is it possible to "embed" an HTML page, using some (system controlled) prefered renderer (like firefox)? In that case it might be possible to get a flash in there and control it through javascript... It does sound a bit far-fetched though.
If you do manage to get the flash in there, you might be able to communicate with it through a TCP/IP connection from the flash to your program.
Flash takes the form of an ActiveX (i.e. COM) DLL on Windows because that's the preferred extensbility platform for Internet Explorer. In other browsers, and on other platforms, Flash takes a different form, using the browser plugin API I believe. Since ActiveX is a no-go on Linux, perhaps it might be possible to implement a plugin host of some sort that can make the Flash plugin think it's running inside a browser. This would probably be "non-trivial" as they say, but theoretically possible.

Screen scraper application (not HTML)

I need screen scraper application which will recognize text from the screen (and not use winapi to do this so source could be in image file). I found a lot of commercial solutions, but I need something open source or free.
I plan to include it in my C# project, so there should be some SDK available.
Thanks.
You could use Tessnet to do character recognition of your images. If you want to screen scrape the desktop, you could potentially just take a screen shot, turn it into an image, and use the OCR library above.
Depending on what you want to do, I have found screen scraper useful for applying patterns against a web site and saving the data that I care about. The tutorial page should give you an idea of what it does.
Screen Scraper's free edition allows scripting in Interpreted Java, JScript, JavaScript, Python, and VBScript... is that close enough?

Using webcam's button in my own program

My webcam has a button, with which you take a photo of current frame
when using it's original software what came with it when I bought it.
Is there any way to use that button to take photos in my program.
I would be using C#.
I was thinking of using Windows Image Acquisition (WIA) or avicap32
for using webcam in my software.
Any help would be appreciated. Where do I start?
EDIT:
I see that you didn't understand me. I need to know if my phisycal camera button is pressed.
I am using DigiMicro 1.3 camera (Manufacturer is DNT), which isn't really a webcam but a USB microscope, but
it behaves like a webcam.
Does the camera actually require that the software be running when you press the button? I know some webcams implement this feature at the driver level. If that's the case, I don't think there's much you can do without interacting directly with the USB port, which would be incredibly difficult and likely not worth the trouble. I can't find any technical documentation on the vendor's website with that kind of information.
The "MicroCapture" software doesn't come with any DLLs that have exported functions, so P/Invoking doesn't appear to be an option. Unfortunately, I can't get the driver installed, so I can't check if it comes with any P/Invoke-able DLLs.
Sorry, but since there's no standard interface for that kind of functionality and the vendor doesn't provide any specific information on it, I don't think this is possible. I would suggest contacting DNT directly about it. They may have some component that will do what you need.
This Coding4Fun post guides you through pretty much everything you need to do to get started using WIA, including adding the reference to a project, displaying the select a device dialog, and of course actually taking the picture :P.
Coding4Fun - Look at me! Windows Image Acquisition
I suggest that you take a look at the DirectShow.NET library. It has great functionality for capturing images/videos off connected devices. It also comes with several samples to get you started quickly.

VLC remotely control from C#

i'm trying to control the VLC Media Player from C#. I tried getting a handle on the window with the FindWindow() command from .Net but as i found out the name of the window changes every time a file is played. The biggest problem i have is sending wm_commands to vlc..This approach worked with Winamp and Windows Media Player but with VLC it appears that it won't work.
I read that VLC can be controlled from a browser but i don't whant that...i've seen in it's settings that it has some hot keys that can be called..but they can be changed and if i call them from my code somehow...and the user changes them..bummer...
i'm a little bit stuck..any help would be fantastic...
Sorin
I have some code that is able to control it using sockets on the RC interface. This worked to a degree but has a lot of quirks. go to full screen seems to do nothing for a few seconds after play is invoked. Overall it sort of works.
The other options are:
Write a DirectDraw filter (very hard) but once this is done VLC can be used instead of or in conjunction with FFMPEG. Existing code that drives media player could use vlc.
Write an interop wrapper for libvlc, recently the VLC team split out libvlccore from libvlc so to the best of my knowledge all the interop is out of date. Once you write a wrapper you could embed vlc in a windows app. (if you need to support x64 you need to compile these libs under x64.
Look through the VLC code and find out if there is a way to send these windows messages.
EDIT This appears to have come out this week.
As Eoin mentioned, libvlc can be used to interact with VLC. As a C# user, you may want to try the .NET bindings offered by the libvlc-sharp project.
Edit: Seems like this project has not been maintained for years. I will leave the link anyway, in case you wish to take a look at it and maybe put some of its source to use.
Have you looked at libvlc
You might be able to wrap that up in a library and interact with VLC through that.
If what you are trying to do is control a previously running executable, check out the Process class to enumerate through all the current processes or do it by name. Check the executable to match vlc.exe. You can then get a handle to the main window and do some P/Invoke to send messages as you are doing with your other executables. This is obviously riddled with potential problems such as if the there are changes to the keyboard shotcuts.
How use libvlc in C++ http://unick-soft.ru/art/files/libvlcProject.zip
I think, use libvlc in C# very similar.
There's also the rc interface and even a telnet one: http://wiki.videolan.org/Console
However, I'd prefer libvlc if possible.

Categories