2

The docs I've found on NPAPI plugins explain how to write plugins to be loaded by browsers, but how hard is it to write an application that loads existing NPAPI plugins?

(My ultimate goal here is to find a way to use SWF content inside an application written with Python and wxPython in Linux. I've accomplished this on Windows by using the comtypes module to load the ActiveX Flash player. For Linux, I'm thinking that wrapping the Gnash NPAPI plugin in some C/C++ code and making this a Python extension seems like it would work, albeit a bit convoluted...)

Jason Boyd
  • 1,192
  • 1
  • 9
  • 19

1 Answers1

0

Your best bet (assuming basing your hosting code on open source software isn't an issue for you licensing-wise) is probably to look at the implementation of NPAPI host in WebKit, Chromium, and/or Gecko.

The Mozilla documentation for the browser side of NPAPI will help, but there are a lot of little corner cases where plugins expect certain behavior because some early browser did it, and now everyone who wants to support those plugins has to do the same thing even if it's not part of the standard; the only way to learn about those is to look at existing implementation.

smorgan
  • 20,228
  • 3
  • 47
  • 55
  • Thanks. I'll look into those. Helpful tip that there are corner cases outside any standard. – Jason Boyd Jul 27 '11 at 03:58
  • From my reading so far, I'm gathering that I need to implement the NPN_* functions of the NPAPI, of which there are 21. (For my app's needs, several of these could be no-op.) Looks like the ones I'd need to implement have to do with allocating memory and handling reading/writing of binary streams, though I'm not yet clear which streams this refers to. Would this for instance be the MIME content (SWF file)? What about communication between the plugin and host runtimes (ExternalInterface)? Am I on the right track? If so, anyone interested in doing a bit of hand-holding with me? – Jason Boyd Jul 29 '11 at 14:54