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

Need Help for Flash Player Plugin

149 views
Skip to first unread message

Manish Patel

unread,
Apr 11, 2009, 7:53:10 AM4/11/09
to dev-tech...@lists.mozilla.org
Hello list members,

I want to develop an application which loads Flash Player plugin in my
window.
I am able to Load and initialize the plugin. I have also received plugin
function by NP_GetEntryPoints call.

All functions executed perfectly.

But not able to see anything on my window.

I am developing this in MAC(Cocoa).

So is there any body who have loaded this successfully.

If possible then provide me link to any help or source code that will work
for me.

I have seen on Thread on your list with title,
NPPVpluginScriptableNPObject segmentation fault with flash
plugin<http://markmail.org/message/2ajuywfak5qxz3lb>

I want to contact this person. If this person reading this mail then please
provide me some help as you have successfully loaded SWF.

--
Regards,
Manish Patel

incorre...@gmail.com

unread,
Apr 13, 2009, 4:48:19 AM4/13/09
to

Could you please paste a piece of your code with a call to NPP_Window
and NPWindow structure initialization. And also the routines to deal
with XEmbed capable widgets.
My program works perfectly with Adobe Flash plug-in (seems ver.
10.0.22.87) on Linux kernel.

Be blessed,
iUm

Manish Patel

unread,
Apr 13, 2009, 5:05:14 AM4/13/09
to incorre...@gmail.com, dev-tech...@lists.mozilla.org
Thanks for reply,
But What is NPP_Window function?
I am calling setwindow function of the flash plugin.
Here is my code for setwindow and NPWindow Structure.

NSRect boundsInWindow = [myView convertRect:[myView bounds] toView:nil];
NSRect visibleRectInWindow = [myView convertRect:[myView visibleRect]
toView:nil];

// Flip Y to convert NSWindow coordinates to top-left-based window
coordinates.
float borderViewHeight = [[myView window] frame].size.height;
boundsInWindow.origin.y = borderViewHeight - NSMaxY(boundsInWindow);
visibleRectInWindow.origin.y = borderViewHeight -
NSMaxY(visibleRectInWindow);

window.type = NPWindowTypeWindow;
window.x = (int32)boundsInWindow.origin.x;
window.y = (int32)boundsInWindow.origin.y;
window.width = static_cast<uint32>(NSWidth(boundsInWindow));
window.height = static_cast<uint32>(NSHeight(boundsInWindow));

NSWindow *realWindow = [myView window];
getNPRect(visibleRectInWindow, window.clipRect);

PortState portState;
if (![myView canDraw])
{
portState = NULL;
return;
}

CGContextRef context = static_cast<CGContextRef>([[NSGraphicsContext
currentContext] graphicsPort]);
PortState_CG *cgPortState = (PortState_CG
*)malloc(sizeof(PortState_CG));
portState = (PortState)cgPortState;
cgPortState->context = context;

nPort.cgPort.window = (WindowPtr)[[myView window] windowRef];
nPort.cgPort.context = context;
window.window = &nPort.cgPort;

CGContextSaveGState(context);
npErr = pluginFuncs.setwindow(plugin, &window);

Here myView is NSView.
What mistake i am making in it?

Your code is working in linux, So could you please provide me source code
for that?
Or provide me some link from where i can get basic idea on loading SWF in
Flash Player plugin.

Thanks,

> _______________________________________________
> dev-tech-plugins mailing list
> dev-tech...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-plugins
>

--
Regards,
Manish Patel

incorre...@gmail.com

unread,
Apr 13, 2009, 6:11:51 AM4/13/09
to
> > dev-tech-plug...@lists.mozilla.org

You're right, i made a typo. That function is called NPP_SetWindow(),
and, btw, you should call it every time your host window changes
position or size. Here's my code snippet for the X server:

GtkWindow *m_gtk_host_window;
GtkWidget *m_gtk_socket;
GdkRectangle m_position;
GdkWindow * const win = m_gtk_socket->window;
NPWindow m_flashNPWindow;
NPSetWindowCallbackStruct m_flashNPWindowInfo;

m_gtk_host_window = (GtkWindow *)gtk_window_new
(GTK_WINDOW_TOPLEVEL); //host window
gtk_widget_realize(GTK_WIDGET(m_gtk_host_window));

m_gtk_socket = gtk_socket_new(); //new GtkSocket for plug-in
gtk_widget_show(m_gtk_socket);
gtk_container_add(GTK_CONTAINER(m_gtk_host_window), m_gtk_socket); //
place it upon the host window

m_position.x = 0;
m_position.y = 0;
m_position.width = m_position.height = 200; //just default values

m_flashNPWindowInfo.type = 0; // should be NP_SETWINDOW but Mozilla
sets it to 0
m_flashNPWindowInfo.display = GDK_WINDOW_XDISPLAY(win);
m_flashNPWindowInfo.visual = GDK_VISUAL_XVISUAL(gdk_drawable_get_visual
(win));
m_flashNPWindowInfo.colormap = GDK_COLORMAP_XCOLORMAP
(gdk_drawable_get_colormap(win));
m_flashNPWindowInfo.depth = gdk_drawable_get_visual(win)->depth;

m_flashNPWindow.ws_info = &m_flashNPWindowInfo;
m_flashNPWindow.type = NPWindowTypeWindow;
m_flashNPWindow.x = m_position.x;
m_flashNPWindow.y = m_position.y;
m_flashNPWindow.width = m_position.width;
m_flashNPWindow.height = m_position.height;
m_flashNPWindow.window = GUINT_TO_POINTER(GDK_WINDOW_XWINDOW(win));

NPP_SetWindow(&instance, &m_flashNPWindow);

Actually, i used GTK for that, because it supports XEmbed protocol via
GtkSocket & GtkPlug widgets, and, btw, Flash plug-in also uses GTK,
afaik. But i have no clue how to initialize NPPort in a right way for
Cocoa case. But you can see some examples by Mozilla:
http://mxr.mozilla.org/mozilla-central/source/modules/plugin/default/mac/DefaultPlugin.mm
- how a plug-in use NPWindow
http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsObjectFrame.cpp#4934
- Firefox on MacOS

incorre...@gmail.com

unread,
Apr 13, 2009, 6:12:00 AM4/13/09
to
> > dev-tech-plug...@lists.mozilla.org

You're right, i made a typo. That function is called NPP_SetWindow(),

0 new messages