8

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:

  1. Ability to play a Flash movie
  2. Ability to receive events (such as mouse clicks)
  3. Ability to send events

Edit: I prefer an open-source solution if possible.

Gili
  • 86,244
  • 97
  • 390
  • 689

8 Answers8

6

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

Gili
  • 86,244
  • 97
  • 390
  • 689
Daniel Spiewak
  • 54,515
  • 14
  • 108
  • 120
  • Great, now that the question has been edited to only refer to C++, my answer sounds stupid and OT. :-) – Daniel Spiewak Oct 18 '08 at 02:29
  • Sorry ;) I was hoping to make the question easier to answer... Great links. Unfortunately Christopher uses SWT to achieve this. It doesn't look like his NativeSwing is interoperable with normal Swing components (which I was hoping to use). – Gili Oct 18 '08 at 02:46
  • Actually, it *is* interoperable, that's the whole reason he did it. :-) You can of course always use SWT by itself, but if you want to embed native stuff like a browser, Windows Media Player or a flash player within Swing, DJ Swing is the way to go. – Daniel Spiewak Oct 18 '08 at 02:51
  • Wow, you're right! That's pretty huge... I'm surprised this hasn't made big news in the Java community. At least I didn't hear about it :) Thanks a lot for this link. You've literally saved me weeks of work. – Gili Oct 18 '08 at 03:11
  • Wow ! This is great. The above link does not work. Here > Refer readMe.md https://github.com/Chrriis/ Get the [DJ Native Swing distribution](https://sourceforge.net/projects/djproject/files/DJ%20Native%20Swing/) on SourceForge. – pullCommitRun Apr 11 '20 at 20:28
1

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

Community
  • 1
  • 1
Juan Delgado
  • 2,030
  • 15
  • 18
1

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.

tstenner
  • 10,080
  • 10
  • 57
  • 92
0

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

Alex
  • 363
  • 1
  • 6
  • 18
0

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

Adam Rosenfield
  • 390,455
  • 97
  • 512
  • 589
0

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.

Heng-Cheong Leong
  • 824
  • 1
  • 8
  • 13
0

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.

Gili
  • 86,244
  • 97
  • 390
  • 689
Eximius
  • 187
  • 1
  • 1
  • 7
-1

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.