December 14, 2011

serpulga serpulga
Lab Rat
27 posts

[SOLVED] Embedding flash player into a QtWebKit application.

Page  
1

Hello,
I’m developing a QtWebKit based application and I need it to support flash player
out of the box.
I already have flash content working by installing the Mozilla flash player plugin and
enabling plugins in the application’s web settings. However, I would like to know if
there’s a way for the application to support flash content from start, without
having to install a separate plugin. The same Google Chrome works.

Thank you

Sergio

17 replies

December 14, 2011

P4C P4C
Lab Rat
16 posts

From what I know you need to put plugin in any path specified in http://doc.qt.nokia.com/latest/qtwebkit.html (ctrl+f “Netscape Plugin Support”) and enable plugins in settings.

You may also try to modify QWebPluginFactory

December 14, 2011

serpulga serpulga
Lab Rat
27 posts

Hello, thank you for replying.
And what would the plugin be?, the one
dll file that comes with flash?

December 14, 2011

P4C P4C
Lab Rat
16 posts

I’m not a Windows specialist. For Linux it would be one file libflash.so

as I found there’s more files in C:\WINDOWS\system32\Macromed\Flash
You need to figure out it yourself. You should be able to remove flash and copy the dll to your executable directory and try it.

Hope I’ve helped you.

December 14, 2011

serpulga serpulga
Lab Rat
27 posts

Yes I tried coping those files that but it didn’t work.
I guess I’ll have to figure out what files are the webkit looking for exactly, and
where.

December 28, 2011

Ashish Mittal Ashish Mittal
Ant Farmer
151 posts

Actually Qwebkit looks for NPSWF32.dll adobe plugin for playing the flash content.
You may find this dll under adobe installed directory on your system.

and add the below mention line in you code.

  1.     QWebView* webViewChild = new QWebView;
  2.      webViewChild->settings()->setAttribute(QWebSettings::PluginsEnabled, true);

[EDIT: code formatting, Volker]

January 1, 2012

serpulga serpulga
Lab Rat
27 posts

Hi, that you for replying.

Yes, the Webkit looks for the standard plugin location.
I was wondering whether there is a way to specify the
directory which it will look for the plugin. That way I could
just deploy the app with a copy of the NPSWF32.dll file and
the Webkit will run Flash content out of the box. It won’t
matter if the ‘user’ has the plugin installed.

January 1, 2012

P4C P4C
Lab Rat
16 posts

I don’t know does the Adobe Flash is distributed with rights “to distribute it” with your program. It may be illegal.

January 1, 2012

Volker Volker
Robot Herder
5428 posts

According to the sources in 4.81 the paths set in the environment variable QTWEBKIT_PLUGIN_PATH are also search for plugins. You might give that a try. Be aware to set the environment before instantiating any webkit classes.

1 src/3rdparty/webkit/Source/WebCore/plugins/PluginDatabase.cpp [qt.gitorious.org]

February 9, 2012

serpulga serpulga
Lab Rat
27 posts

Hello,

I can’t find a way to set this environment variable: QTWEBKIT_PLUGIN_PATH.
I don’t have any experience doing these procedures before.

Could you please give me some pointer? or a short code example?

Thank you

February 9, 2012

Ashish Mittal Ashish Mittal
Ant Farmer
151 posts

Hi,

you can not distribute Adobe plugins binaries along with your application.
In the installation pacakge of your project ask user to download the latest plugin from the adobe website.
It is against the copyright to distribute adobe dll’s with third party app.

February 9, 2012

serpulga serpulga
Lab Rat
27 posts

Ashish Mittal wrote:
Hi,

you can not distribute Adobe plugins binaries along with your application.
In the installation pacakge of your project ask user to download the latest plugin from the adobe website.
It is against the copyright to distribute adobe dll’s with third party app.

Thank you for your reply.

I still would like to know how to do the procedure indicated by Volker.

Volker wrote:
According to the sources in 4.81 the paths set in the environment variable QTWEBKIT_PLUGIN_PATH are also search for plugins. You might give that a try. Be aware to set the environment before instantiating any webkit classes.

1 src/3rdparty/webkit/Source/WebCore/plugins/PluginDatabase.cpp [qt.gitorious.org]

February 10, 2012

Volker Volker
Robot Herder
5428 posts

  1. qputenv("QTWEBKIT_PLUGIN_PATH", "/path/to/the/plugin/directory");

February 10, 2012

serpulga serpulga
Lab Rat
27 posts
Volker wrote:
@ qputenv(“QTWEBKIT_PLUGIN_PATH”, “/path/to/the/plugin/directory”); @

That’s it. That’s the command I needed.

Thank you very much.

February 10, 2012

Volker Volker
Robot Herder
5428 posts

You’re welcome. If your issue is solved, it would be nice to add [Solved] to the topic. Just hit the edit link to the right of the very first post and adjust the title. Thanks!

February 10, 2012

serpulga serpulga
Lab Rat
27 posts

Hi,

Thank you again, I was going to do that but
I thought there was a more systematic way for doing so (and didn’t find it).

Page  
1

  ‹‹ How to set win32 window as a parent of QWebView widget window.      QWebView as child widget. Page position problem. ››

You must log in to post a reply. Not a member yet? Register here!