QtWebKit playing HTML5 video without installing flash player

Allen picture Allen · Dec 27, 2011 · Viewed 9.2k times · Source

With latest Flash player installed, and enable the Plugins, my simple example can play youtube videos

OS: windows 7

Qt: 4.7.4 (both 32 & 64bit works)

However, according to "http://www.youtube.com/html5", my example browser supports "Video tag" and "H.264", I was wondering why can't I just DISABLE the Plugins and play the video as usual? I have followed the procedure of " Watch a Video in YouTube's HTML5 Player" http://googlesystem.blogspot.com/2010/08/watch-video-in-youtubes-html5-player.html

but not work at all~

Here is my code:

int main(int argc, char *argv[])
{

  QApplication a(argc, argv);

  //QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);

  QWebView *view = new QWebView();
  view->load(QUrl("http://www.youtube.com/watch?v=cTl3U6aSd2w&html5=True"));
  view->show();
  return a.exec();
 }

Is there any code missing or I should enable anything else?

Thanks.

Answer

Diego picture Diego · Dec 28, 2011

I think the version you are using doesn't have html5 video support.

From the QtWebKit page:

Web Developer Features

These are some of the new features present in QtWebKit-2.2:

Support for HTML5 media (audio/video)

http://trac.webkit.org/wiki/QtWebKitFeatures22#WebDeveloperFeatures

QtWebKit 2.2 is included in Qt-4.8.