Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Linux: Instance Invalid error returned by flash plugin

8 views
Skip to first unread message

mugdha...@gmail.com

unread,
Jul 12, 2007, 12:33:03 PM7/12/07
to

Hi there,

I'm having some problems getting netscape plugins to run from my
application; I hope somebody can help me with this.

I am writing a Qt application in Linux to play flash files. Basically,
what I'm trying to do is running the flash plugin from my own little
test application. I am able to receive the Plugin function pointers,
name, description. But when I call the plugin function NPP_New with a
valid instance ( NPP) parameter, it returns
"NPERR_INSTANCE_INVALID_ERROR".

When I use the same code with npflash.so (http://www.swift-tools.net/
Flash/), it does not give me any error and creates a valid plugin
instance. Is there something specific that I need to pass to Adobe
plugin?

Thanks in advance,
Mugdha.

Mike Melanson

unread,
Jul 12, 2007, 9:03:35 AM7/12/07
to mugdha...@gmail.com, dev-tech...@lists.mozilla.org
mugdha...@gmail.com wrote:
> Hi there,
>
> I'm having some problems getting netscape plugins to run from my
> application; I hope somebody can help me with this.
>
> I am writing a Qt application in Linux to play flash files. Basically,
> what I'm trying to do is running the flash plugin from my own little
> test application. I am able to receive the Plugin function pointers,
> name, description. But when I call the plugin function NPP_New with a
> valid instance ( NPP) parameter, it returns
> "NPERR_INSTANCE_INVALID_ERROR".

Just curious: which version of the Adobe Flash Plugin for Linux are you
using?

--
-Mike Melanson

mugdha...@gmail.com

unread,
Jul 12, 2007, 12:59:37 PM7/12/07
to
On Jul 12, 7:03 am, Mike Melanson <m...@multimedia.cx> wrote:

Version - 9.0.60.120

- Mugdha.

Mike Melanson

unread,
Jul 12, 2007, 1:04:43 PM7/12/07
to mugdha...@gmail.com, dev-tech...@lists.mozilla.org

IOW, the latest beta available from Adobe. Are you using XEmbed to talk
to the plugin? Future versions of the Linux Flash Player will require
it, as this beta now does.

You can use the open source DiamondX plugin as a simpler method for
understanding how this XEmbed stuff works:

http://multimedia.cx/diamondx/

--
-Mike Melanson

mugdha...@gmail.com

unread,
Jul 12, 2007, 6:35:58 PM7/12/07
to

The DiamondX plugin also creates an instance and sets the window. The
adobe plugin still returns an Invalid instance error. Is there
anything else that I can do?

Thanks for the help
Mugdha.

Mike Melanson

unread,
Jul 12, 2007, 9:28:48 PM7/12/07
to mugdha...@gmail.com, dev-tech...@lists.mozilla.org
mugdha...@gmail.com wrote:
> The DiamondX plugin also creates an instance and sets the window. The

Does that mean the DiamondX plugin worked in your app, i.e., showed a
diamond?

> adobe plugin still returns an Invalid instance error. Is there
> anything else that I can do?

All I can advise is to make sure that the communication between your app
and the plugin mirrors how Mozilla interacts with the plugin.

--
-Mike Melanson

mugdha...@gmail.com

unread,
Jul 20, 2007, 5:24:10 PM7/20/07
to
On Jul 12, 7:28 pm, Mike Melanson <m...@multimedia.cx> wrote:

> mugdhajai...@gmail.com wrote:
> > The DiamondX plugin also creates an instance and sets the window. The
>
> Does that mean the DiamondX plugin worked in your app, i.e., showed a
> diamond?

Yes, it shows the Diamond in my app. The communication also looks
similar to what Mozilla uses. I am getting the error in the call to
NPP_New itself, so there should be something that I am missing in the
flash plugin which is no importance to any other plugin.

Thanks,
Mugdha.

rickwookie

unread,
Jul 24, 2007, 8:56:38 AM7/24/07
to
On Jul 20, 10:24 pm, mugdhajai...@gmail.com wrote:
> On Jul 12, 7:28 pm, Mike Melanson <m...@multimedia.cx> wrote:
>
> > mugdhajai...@gmail.com wrote:
> > > The DiamondX plugin also creates an instance and sets the window. The
>
> > Does that mean the DiamondX plugin worked in your app, i.e., showed a
> > diamond?
>
> Yes, it shows the Diamond in my app. The communication also looks
> similar to what Mozilla uses. I am getting the error in the call to
> NPP_New itself, so there should be something that I am missing in theflashplugin which is no importance to any other plugin.

>
> Thanks,
> Mugdha.
>
>
>
>
>
> > > adobe plugin still returns an Invalid instance error. Is there
> > > anything else that I can do?
>
> > All I can advise is to make sure that the communication between your app
> > and the plugin mirrors how Mozilla interacts with the plugin.
>
> > --
> > -Mike Melanson- Hide quoted text -
>
> - Show quoted text -

I too am trying to get the Flash plugin to embed into my QT app.

I'd love to have any information you could spare as to how you got as
far as you have.

Many thanks.
R.

mugdha...@gmail.com

unread,
Jul 25, 2007, 10:43:27 AM7/25/07
to


Hi,

I haven't got much success with the Adobe Flash plugin, but yes I have
got the DiamondX plugin working in my app.

What I would suggest is go through the doc ->http://docs.rinet.ru/
Plugi/index.htm

This would give you the basics of about NPAPI. Apart from that, I
would suggest instead of starting with the flash plugin, start with
the DiamondX plugin since it is open source and it gives you an idea
what is going on at the other end.

Hope that helps.
Mugdha.

fcor...@numerica.com.co

unread,
Jul 27, 2007, 5:18:51 PM7/27/07
to

Hi,

I have the same problem, diamondx plugin works fine embeded in my qt
app but flash does no work.

According to the program nm, libflashplayer.so does not have symbol
(function) NPP_NEW and diamondx if has it, I believe that is the
problem.

The nm ouput:

// libflashplayer
$ nm -D libflashplayer.so | grep NP
0002a788 T NP_GetMIMEDescription
0002a7a5 T NP_GetValue
0002a857 T NP_Initialize
0002aafd T NP_Shutdown

// libdiamondx
$ nm -D libdiamondx.so | grep NP
000034e0 T NP_GetMIMEDescription
00003460 T NP_GetValue
000032a0 T NP_Initialize
00003020 T NPN_DestroyStream
000031e0 T NPN_ForceRedraw
00002e50 T NPN_GetURL
00002e90 T NPN_GetURLNotify
00002dd0 T NPN_GetValue
00003180 T NPN_InvalidateRect
000031b0 T NPN_InvalidateRegion
000030c0 T NPN_MemAlloc
00003120 T NPN_MemFlush
000030f0 T NPN_MemFree
00002fa0 T NPN_NewStream
00003240 T NPN_PopPopupsEnabledState
00002ed0 T NPN_PostURL
00002f20 T NPN_PostURLNotify
00003210 T NPN_PushPopupsEnabledState
00003150 T NPN_ReloadPlugins
00002f70 T NPN_RequestRead
00002e10 T NPN_SetValue
00003060 T NPN_Status
00003090 T NPN_UserAgent
00002d90 T NPN_Version
00002fe0 T NPN_Write
00002aa0 T NPP_Destroy
000028d0 T NPP_DestroyStream
00002930 T NPP_GetMIMEDescription
00002d10 T NPP_GetValue
00002960 T NPP_HandleEvent
00002cd0 T NPP_Initialize
00002b30 T NPP_New
00002810 T NPP_Print
00002a60 T NPP_SetWindow
00002900 T NPP_Shutdown
000028a0 T NPP_StreamAsFile
00002870 T NPP_URLNotify
000029a0 T NPP_Write
00002a00 T NPP_WriteReady
00003280 T NP_Shutdown

rickwookie

unread,
Jul 30, 2007, 7:27:56 AM7/30/07
to
> Mugdha.- Hide quoted text -

>
> - Show quoted text -

Many thanks!

Hopefully the link you gave me (http://docs.rinet.ru/Plugi/index.htm)
will be more useful than the API docs I was reading here:
http://web.archive.org/web/20040203041440/http://devedge.netscape.com/library/manuals/2002/plugin/1.0/

For a start it tells me that NP_Initialize should be past
NPNetscapeFuncs, whereas the guide I was looking at just shows NPError
NP_Initialize(void).
This would explain why I was getting an NPError of
NPERR_INCOMPATIBLE_VERSION_ERROR when I called NP_Initialize() for the
DiamondX plugin!

Sorry if it looks like I don't have a clue, but I'm new to Linux
development. On windows I write apps that incorporate flash using
ActiveX and respond to flash's FSCommand, for which it's pretty
straightforward. That doc at rinet.ru should help me get a bit further
though!

Going forward, will I ever be able to get my Linux app to respond to
an FSCommand in the flash, or am I wasting my time (ie it's not
possible)?

Cheers,
Richard.

Mike Melanson

unread,
Jul 30, 2007, 11:26:59 AM7/30/07
to rickwookie, dev-tech...@lists.mozilla.org
rickwookie wrote:
> Going forward, will I ever be able to get my Linux app to respond to
> an FSCommand in the flash, or am I wasting my time (ie it's not
> possible)?

What exactly are you trying to do?

--
-Mike Melanson

fcor...@numerica.com.co

unread,
Jul 30, 2007, 1:18:33 PM7/30/07
to

Excuse me, I was trying to link directly to the libflashplayer.so
(diamondx if expose all functions NPP*, flashplayer no), but now I am
using function NP_Initialize(NPNetscapeFuncs* aNPNFuncs,
NPPluginFuncs* aNPPFuncs), and thus if it finds the function NPP_New

mugdha...@gmail.com

unread,
Jul 30, 2007, 3:53:33 PM7/30/07
to

I am sorry, I am not able to understand you here. What I do is, I call
the NP_Initialize function, and it does the exchange of function
pointers. This gives me the pointer to the function NPP_New and that
is how I call that function. I do the same for the DiamondX plugin
functions as well and it works fine. Now in the flash plugin, when I
call the function NPP_New it returns me the error of "Invalid
Instance".

mugdha...@gmail.com

unread,
Jul 30, 2007, 3:56:39 PM7/30/07
to
> will be more useful than the API docs I was reading here:http://web.archive.org/web/20040203041440/http://devedge.netscape.com...

>
> For a start it tells me that NP_Initialize should be past
> NPNetscapeFuncs, whereas the guide I was looking at just shows NPError
> NP_Initialize(void).
> This would explain why I was getting an NPError of
> NPERR_INCOMPATIBLE_VERSION_ERROR when I called NP_Initialize() for the
> DiamondX plugin!

If you are working in Linux, the function call to NP_Initialize is
NP_Initialize(NPNetscapeFuncs* aNPNFuncs,
NPPluginFuncs* aNPPFuncs). You might get the
NPERR_INCOMPATIBLE_VERSION_ERROR becuase you are not setting the
proper version parameters in the NPNetscapeFuncs. Also check that your
npapi.h is the latest one, otherwise it will return error again.

Hope that helps!
Mugdha.

rickwookie

unread,
Jul 31, 2007, 5:34:19 AM7/31/07
to
> > Richard.- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -

>
> - Show quoted text -

Yes, thanks again. I finally found some more up-to-date docs at
http://developer.mozilla.org/ whereas I'd been looking previously at
the docs at http://devedge-temp.mozilla.org/ (Try Googling for
'NP_Initialize' and it seems Google is not always your friend!).

Anyway, there it actually shows the two different prototypes (Windows
or Linux) for NP_Initialize.

Cheers.

rickwookie

unread,
Jul 31, 2007, 5:41:34 AM7/31/07
to

I have various swf files that will issue FSCommands in response to
user actions or timeline events. On Windows we can write a C++ app
that has the Flash ActiveX plugin embedded and can therefore respond
to these FSCommand events (by examining the two args passed by
FSCommand) and respond accordingly. We can also use the plugin's
SetVariable function to pass data back to the plugin.

We wan't to be able to write an app in Linux to communicate with those
same swf files.

That's what we're trying to do, so it would be good to know if it will
even be possible.

Cheers,
Richard.

mugdha...@gmail.com

unread,
Jul 31, 2007, 10:39:19 AM7/31/07
to

> Yes, thanks again. I finally found some more up-to-date docs athttp://developer.mozilla.org/whereas I'd been looking previously at
> the docs athttp://devedge-temp.mozilla.org/(Try Googling for

> 'NP_Initialize' and it seems Google is not always your friend!).
>
> Anyway, there it actually shows the two different prototypes (Windows
> or Linux) for NP_Initialize.
>
> Cheers.

So were you able to create an instance of the Flash plugin?

- Mugdha

rickwookie

unread,
Aug 2, 2007, 9:00:35 AM8/2/07
to
On Jul 31, 3:39 pm, mugdhajai...@gmail.com wrote:
> > Yes, thanks again. I finally found some more up-to-date docs athttp://developer.mozilla.org/whereasI'd been looking previously at
> > the docs athttp://devedge-temp.mozilla.org/(TryGoogling for

> > 'NP_Initialize' and it seems Google is not always your friend!).
>
> > Anyway, there it actually shows the two different prototypes (Windows
> > or Linux) for NP_Initialize.
>
> > Cheers.
>
> So were you able to create an instance of the Flash plugin?
>
> - Mugdha

No, but then I have yet to successfully create an instance of the
DiamondX plugin :-(
I know it's not really much help to you, but I'm really struggling to
find any help with actually writing an app to host plugins (plenty of
info on writing plugins, but that's not what we're trying to do).
Maybe if I had some pointers to get the DiamondX plugin hosted, then I
would be able to move onto the flash plugin and possible make some
progress there. I think I possibly just need to work out which of the
NPNetscapeFuncs I need to implement (as a bare minimum to get the
plugin going).

Cheers,
R.

rickwookie

unread,
Aug 2, 2007, 1:09:31 PM8/2/07
to
On Jul 31, 3:39 pm, mugdhajai...@gmail.com wrote:
> > Yes, thanks again. I finally found some more up-to-date docs athttp://developer.mozilla.org/whereasI'd been looking previously at
> > the docs athttp://devedge-temp.mozilla.org/(TryGoogling for

> > 'NP_Initialize' and it seems Google is not always your friend!).
>
> > Anyway, there it actually shows the two different prototypes (Windows
> > or Linux) for NP_Initialize.
>
> > Cheers.
>
> So were you able to create an instance of the Flash plugin?
>
> - Mugdha

Ok, I've got as far as creating a instance of the DiamondX plugin (by
implementing NPN_GetValue to set 'value' to true when 'variable' ==
NPNVSupportsXEmbedBool and return NPERR_NO_ERROR; and implementing
NPN_MemAlloc to return a void pointer from passing 'size' to malloc).

When I switch from loading DiamondX to Flash, I too get
NPERR_INVALID_INSTANCE_ERROR when creating a new instance. However, I
think I should create dummy functions for all of the NPNetscapeFuncs
to see at least which ones are being called by the flash plugin
(possibly before it happily creates a new instance). The fact that
there's no source available for the Flash plugin makes this a trial-
and-error thing really. Hopefully Mike Melanson can steer us in the
right direction. :-)

Cheers,
R.

Mike Melanson

unread,
Aug 2, 2007, 1:47:01 PM8/2/07
to rickwookie, dev-tech...@lists.mozilla.org
rickwookie wrote:
> (possibly before it happily creates a new instance). The fact that
> there's no source available for the Flash plugin makes this a trial-
> and-error thing really. Hopefully Mike Melanson can steer us in the
> right direction. :-)

What MIME type are you sending in?

--
-Mike Melanson

rickwookie

unread,
Aug 2, 2007, 6:45:37 PM8/2/07
to

D'Oh!

Good point Mike, it might help if I wasn't just passing the same embed
vars as I had been to the DiamondX plugin!

I'll try again tomorrow, with the correct vars, and let you know if it
works.

R.

rickwookie

unread,
Aug 3, 2007, 6:33:37 AM8/3/07
to

Okay it seems I was not setting the NPMIMEType to anything but passing
it using the arrays argn and argv as "type" and "application/x-
diamondx" respectively. This seemed fine for DiamondX since it doesn't
appear to check/use NPMIMEType before it returns NPERR_NO_ERROR for
NPP_New.

For Flash, if I have NPMIMEType set to anything other than
"application/x-shockwave-flash" then NPP_New returns
NPERR_INVALID_INSTANCE_ERROR. When I set it to "application/x-
shockwave-flash" I get a Segmentation fault, so I suppose that's
progress :-(

It would be useful to know the steps that the Flash plugin's NPP_New
takes (ie what my code needs to respond to) in order to get a
successful NPERR_NO_ERROR return.

Cheers,
R.

rickwookie

unread,
Aug 3, 2007, 8:33:40 AM8/3/07
to

Okay, as I'm slowly implementing the NPNetscapeFuncs I see that Flash
calls NPN_UserAgent. Do I need to return any particular string? I'm
returning "My Browser", and after that I get:
(process:14047): GLib-GObject-CRITICAL **: gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function
(process:14047): Gtk-CRITICAL **: gtk_clipboard_get_for_display:
assertion `GDK_IS_DISPLAY (display)' failed
Adobe FlashPlayer: gtk_clipboard_get(GDK_SELECTION_PRIMARY); failed.
Trying to call gtk_init(0,0);

I'll slog on.

R.

Mike Melanson

unread,
Aug 3, 2007, 12:06:54 PM8/3/07
to rickwookie, dev-tech...@lists.mozilla.org
rickwookie wrote:
> Okay, as I'm slowly implementing the NPNetscapeFuncs I see that Flash
> calls NPN_UserAgent. Do I need to return any particular string? I'm
> returning "My Browser", and after that I get:

Try lying and returning a more official Mozilla-type string. That may
solve some problems (but it may not).

> (process:14047): GLib-GObject-CRITICAL **: gtype.c:2242:
> initialization assertion failed, use IA__g_type_init() prior to this
> function
> (process:14047): Gtk-CRITICAL **: gtk_clipboard_get_for_display:
> assertion `GDK_IS_DISPLAY (display)' failed
> Adobe FlashPlayer: gtk_clipboard_get(GDK_SELECTION_PRIMARY); failed.
> Trying to call gtk_init(0,0);

Do you have GTK installed? The latest Linux Flash Player 9 requires it.

--
-Mike Melanson

mugdha...@gmail.com

unread,
Aug 7, 2007, 11:45:03 AM8/7/07
to

I had the same problem that when I was passing the MimeType as
"application/x-shockwave-flash", it was giving me segmentation fault.
Then I changed it to "application\\/x-shockwave-flash" and it started
to give me the Instance Error.

While trying to get the DiamondX plugin working I used Gtk. Now when I
moved back to Flahs plugin and I changed the Mime type back to
"application/x-shockwave-flash", it works. Any help on how to get the
flash movie playing after setting the window.

Thanks
Mugdha.

fcor...@numerica.com.co

unread,
Aug 10, 2007, 11:10:21 AM8/10/07
to

Try with Flash Player 9 Update (Shockwave Flash 9.0 r60) at
http://labs.adobe.com/downloads/flashplayer9.html

it's work for me:
.
.
.
Display *dsp = QX11Info::display();
NPWindow npwin;
NPSetWindowCallbackStruct swcb;
memset((void*) &swcb, 0, sizeof(NPSetWindowCallbackStruct));
swcb.type = 0;//NP_SETWINDOW;
swcb.display = dsp;
swcb.visual = DefaultVisual(swcb.display,
DefaultScreen(swcb.display));
swcb.colormap =
DefaultColormap(swcb.display,DefaultScreen(swcb.display));
swcb.depth = DefaultDepth(swcb.display,
DefaultScreen(swcb.display));

npwin.x = 0;
npwin.y = 0;
npwin.width = plugin->width;
npwin.height = plugin->height;
npwin.type = NPWindowTypeWindow;
npwin.window = (void *)plugin->window; //QX11EmbedContainer
widget winId()
npwin.ws_info = (void *)&swcb;

int r;
r = fCallbacks.newp("application/x-shockwave-flash",
instance,NP_FULL, npp_argc, npp_argn,npp_argv,0);
printf("*** NPP_New %d\n", r); //print 0
r = fCallbacks.setwindow(instance, &npwin);
printf("*** NPP_SetWindow %d\n", r); //print 0
.
.
.
.

fcor...@numerica.com.co

unread,
Aug 10, 2007, 9:20:37 PM8/10/07
to
> Try with Flash Player 9 Update (Shockwave Flash 9.0 r60) athttp://labs.adobe.com/downloads/flashplayer9.html

The Flash Player Plugin (Shockwave Flash 9.0 r60) is working fine in
my qt app, now only need know how to resize the plugin when te
container widget (QX11EmbedContainer) is resized. some body know how
to i do it??

jonatha...@yahoo.de

unread,
Aug 11, 2007, 4:08:14 AM8/11/07
to

Another call to NPP_SetWindow with the new size parameters should be
enough.

rickwookie

unread,
Aug 13, 2007, 9:21:22 AM8/13/07
to

I'm confused... ...I'm using QT with QDevelop to write my app, but
it's been suggested that I need to use GTK to get this to work.

Since it's working fine in your qt app, are you using GTK?

fcor...@numerica.com.co

unread,
Aug 13, 2007, 12:56:53 PM8/13/07
to

No, gtk libs are installed in my linux pc (flashplayer require it),
but the app is pure Qt.

mugdha...@gmail.com

unread,
Aug 13, 2007, 3:28:08 PM8/13/07
to
> > > > > > Do you have GTK installed? The latestLinuxFlash Player 9 requires it.
> No, gtk libs are installed in mylinuxpc (flashplayer require it),

> but the app is pure Qt.

But, when I am using pure Qt app, it gives me errors like

(process:14047): GLib-GObject-CRITICAL **: gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function
(process:14047): Gtk-CRITICAL **: gtk_clipboard_get_for_display:
assertion `GDK_IS_DISPLAY (display)' failed
Adobe FlashPlayer: gtk_clipboard_get(GDK_SELECTION_PRIMARY); failed.
Trying to call gtk_init(0,0);

I don't get any such errors when I create a gtk window and embed it in
Qt.

As a side note, I have my flash app working now :)

-Mugdha

fcor...@numerica.com.co

unread,
Aug 13, 2007, 5:25:07 PM8/13/07
to

These same messages appear when flash is used in Konqueror and Opera,
seems to be some validation of gtk that does the flash plugin when
NPP_New is invoked, nevertheless the process returns no error and wotk
fine.

mugdha...@gmail.com

unread,
Aug 20, 2007, 1:42:01 PM8/20/07
to

Is there a way to capture the paint event sent by flash to the
embedded window?

I know it can be done in Windows, but how to do it in linux? Any
ideas?

- Mugdha

fcor...@numerica.com.co

unread,
Aug 21, 2007, 6:12:42 PM8/21/07
to

Whit Qt the follow code work fine:

MyClass::MyClass(QWidget *parent, const char *name, Qt::WindowFlags
f) : QWidget(parent, name, f)
{
.
.
.
container = new QX11EmbedContainer(this);
layout->addWidget(container);
container->installEventFilter(this);
.
.
.
}

bool MyClass::eventFilter(QObject *obj, QEvent *event)
{
if(event->type()==QEvent::Paint)
{
// your code
.
.
.
return QObject::eventFilter(obj, event);
}
else
return QObject::eventFilter(obj, event);
}

mugdha...@gmail.com

unread,
Aug 24, 2007, 4:33:19 PM8/24/07
to
Thanks for your help. I know this can be used to capture events in Qt,
but this does not capture the events that are sent by flash plugin.
What i mean is that, if the content displayed on the window is
changing, flash, would be sending an event telling the window to
update, and I need to capture that event.

I created an X11EventFilter on the main QApplication, but that too
doesn't take the mouse move events and events that the flash plugin
would send to the window to update itself. An "expose" in case of
XEvent I guess. Though this captures the keyboard events, which seems
very strange to me.

- Mugdha

mugdha...@gmail.com

unread,
Oct 9, 2007, 11:43:13 AM10/9/07
to

> The Flash PlayerPlugin(Shockwave Flash 9.0 r60) is working fine in
> my qt app, now only need know how toresizethepluginwhen te

> container widget (QX11EmbedContainer) is resized. some body know how
> to i do it??

Were you able to do this by another call to setwindow? I get a
segmentation fault when I make a second call to setwindow function.

- Mugdha

0 new messages