Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QtWebKit Windows html5 video support
We have an application using Qt-4.8.4 (via PySide) that uses QtWebkit and attempts to display a video via the HTML5 <video> tag. This works correctly on Linux and Mac OS X. Unfortunately, it does not work on Windows. There are numerous reports available online that suggest that many others have run into the same issue. For example here is one:
We have built Qt with QtMobility (with directshow QtMultimedia plugin for media) as suggested there and even though video’s play occasionally, the application is very unstable and reloading the webpage for example crashes the application. It is also not entirely reproducible in that on some Windows machines nothing plays at all and on those that it does play, the application is very unstable. WMV files do seem to play, but aren’t seekable.
The Qt 5.0 official builds also do not solve this issue. Other reports online indicate that this does not work with 5.0.
We would really appreciate any information on when this will be fixed. Has anyone else gotten this to work reliably? We would really appreciate any information on what is needed or more details on what is needed to fix it. We are willing to help with the fix where we can.
I need your help.
How did you use QtWebKit to display a video via the HTML5<video> tag on Linux?
Which macro did you open in the WebCore.pro? ENABLE_VIDEO?
I always got some errors when compiling the QtWebKit, such as
"../../../Source/WebCore/platform/graphics/MediaPlayer.cpp:196: error: 'PlatformMediaEngineClassName' has not been declared",
“platform/graphics/qt/MediaPlayerPrivateQt.h:25: fatal error: QMediaPlayer: No such file or directory”,and so on.
Is there many macro should be opened in the WebCore.pro or other plugin should be added?
Can you give some suggestion?
I do not recollect needing anything special for html5 playback on linux. You just need the minimum versions of the dependencies (especially gstreamer, glib and gst-plugins-base), and their .pc (pkgconfig) files in the PKG_CONFIG_PATH, if you are manually installing them.
The QtWebkit configure script automatically enables video playback in case it can detect correct dependencies.
My scheme is as follows(Support HTML5 video on (Linux) mips platform):
First,the browser pass the url to QtWebKit;
Second,implement communication between QtWebKit and Gstreamer in MediaPlayerPrivateInterface.h(implement the virtual function)
You mean it's unnecessary to add "DEFINE += ENABLE_VIDEO=1" and other macro in WebCore.pro.
And any operation is superfluous to support HTML5 video in QtWebKit source code.
What I should do is just installing them (dbus-1.1.20,flex-2.5.34...) correctly.
Am I right?
I'm not sure if mips makes any difference (it shouldn't), but you do not need to implement MediaPlayerPrivateInterface.h yourself . It is already implemented in the gstreamer backend:
You just need to ensure that it is being built, by having it find the correct dependencies. And yes, you do not explicitly need to add "DEFINE += ENABLE_VIDEO=1", it is automatically enabled if correct gstreamer is found.
I installed the dependencies by compiling them from source into a separate prefix on centos 5 (since centos 5 has old versions), but it works with the distro packaged versions of libraries/devel-packages on any recent distro. And the versions i mentioned are the minimum requirements, it should work fine if you have newer versions installed.
You mean that the ENABLE_VIDEO=1 label is the default setting, whether the correct gstreamer is found or not, right?
The gstreamer I used is not the standard gstreamer. So I want to implement the communication between QtWebKit and my own gstreamer.
I'm not sure whether the MediaPlayerInterface.h will be built in MediaPlayer.cpp if I do nothing in the WebCore.pro and correct gstreamer is not set.
Thanks for your help.