With latest Flash player installed, and enable the Plugins, my simple example can play youtube videos
安装了最新的Flash播放器,并启用了插件,我的简单示例可以播放youtube视频。
OS: windows 7
操作系统:windows 7
Qt: 4.7.4 (both 32 & 64bit works)
Qt: 4.7.4(32和64位均可)
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
但是,根据“http://www.youtube.com/html5”,我的示例浏览器支持“视频标签”和“H.264”,我想知道为什么我不能像往常一样禁用插件并播放视频?我遵循了“在YouTube的HTML5播放器上观看视频”的过程。
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.
谢谢。
3 个解决方案
#1
1
I think the version you are using doesn't have html5 video support.
我认为你所使用的版本没有html5视频支持。
From the QtWebKit page:
从QtWebKit页面:
Web Developer Features
Web开发人员的特性
These are some of the new features present in QtWebKit-2.2:
这些是QtWebKit-2.2中的一些新特性:
Support for HTML5 media (audio/video)
支持HTML5媒体(音频/视频)
http://trac.webkit.org/wiki/QtWebKitFeatures22#WebDeveloperFeatures
http://trac.webkit.org/wiki/QtWebKitFeatures22 WebDeveloperFeatures
QtWebKit 2.2 is included in Qt-4.8.
QtWebKit 2.2包含在Qt-4.8中。
#2
1
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/
我写了一篇博文,介绍我如何解决这个项目的问题。它涉及到构建Qt + Qt -mobility,以及Qt -mobility中的bug修复。参见http://blog.enthought.com/open-source/fun-with-qtwebkit-html5-video/
#3
0
Just do something like that
就这样做吧。
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
#1
1
I think the version you are using doesn't have html5 video support.
我认为你所使用的版本没有html5视频支持。
From the QtWebKit page:
从QtWebKit页面:
Web Developer Features
Web开发人员的特性
These are some of the new features present in QtWebKit-2.2:
这些是QtWebKit-2.2中的一些新特性:
Support for HTML5 media (audio/video)
支持HTML5媒体(音频/视频)
http://trac.webkit.org/wiki/QtWebKitFeatures22#WebDeveloperFeatures
http://trac.webkit.org/wiki/QtWebKitFeatures22 WebDeveloperFeatures
QtWebKit 2.2 is included in Qt-4.8.
QtWebKit 2.2包含在Qt-4.8中。
#2
1
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/
我写了一篇博文,介绍我如何解决这个项目的问题。它涉及到构建Qt + Qt -mobility,以及Qt -mobility中的bug修复。参见http://blog.enthought.com/open-source/fun-with-qtwebkit-html5-video/
#3
0
Just do something like that
就这样做吧。
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);