QtWebKit playing HTML5 video without installing flash player

最后都变了- 提交于 2019-12-06 07:55:30

问题


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.


回答1:


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.




回答2:


I've written a blog post about how I've solved this issue for our project. It involves building Qt + qt-mobility, and also a bug fix in qt-mobility. See http://blog.enthought.com/open-source/fun-with-qtwebkit-html5-video/




回答3:


Just do something like that

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


来源:https://stackoverflow.com/questions/8650119/qtwebkit-playing-html5-video-without-installing-flash-player

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!