Qt5 QWebView HTML5视频标签支持 [英] Qt5 QWebView HTML5 video tag support

查看:132
本文介绍了Qt5 QWebView HTML5视频标签支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试使用HTML5视频支持在Qt的QWebView中播放.mp4文件(我不能使用任何插件或adobe flash)。

我有3个系统。新安装的Windows 7 x64,Mac OS X 10.7和Windows xp X64。

我为Windows和Mac获得了新的Qt 5.0并安装在所有系统上。我还在所有3个系统上安装了完整的VLC(用于编解码器)。然后我创建一个Qt程序如下。



Hi All,
I am trying to play .mp4 file in QWebView of Qt using HTML5 video support(I can not use any plugin or adobe flash).
I have 3 system. newly installed Windows 7 x64, Mac OS X 10.7 and Windows xp X64.
I get new Qt 5.0 for windows and Mac and installed on all systems. I have also installed full VLC (for codec) on all 3 system. Then i create a Qt program as below.

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QWebView view;
    QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
    view.settings()->setAttribute(QWebSettings::PluginsEnabled, true);
    QUrl url("http://www.html5test.com"); // html5test.com is site to check which features of html5 your browser supports.
    view.load(url);
    view.show();
    return a.exec();
}



我看到的是在Windows 7和Mac OS X上支持的视频和音频标签,以及两个操作系统都支持MP4视频格式。但它在Windows XP x64上显示0评级,用于支持视频标签。我为此谷歌,但无法得到任何帮助。 为什么它说Windows xp X64不支持视频和音频标签?



之后,我尝试使用


What i see is On windows 7 and Mac OS X gives that video and audio tag supported, and also MP4 video format supported on both os. But it shows 0 rating on windows xp x64 for video tag support. I google for this but could not get anything helpful. Why it says that video and audio tag not supported on Windows xp X64?

After that i try to load a website having different videos with

<video>

标记如下。



tag as below.

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    QWebView view;
    QWebSettings::globalSettings()-&gt;setAttribute(QWebSettings::PluginsEnabled, true);
    view.settings()->setAttribute(QWebSettings::PluginsEnabled, true);
    QUrl url("http://shapeshed.com/examples/HTML5-video-element/");// having video tags
    view.load(url);
    view.show();
    return a.exec();
}







当我运行上面的代码时,在Mac上按需要运行。在Windows 7上显示视频控件(播放按钮,搜索栏),但无法播放视频。并且在Windows xp X64机器上没有可见的视频和视频控制。

如果支持视频标签和mp4(和H.264),那么Windows 7机器是什么?

我在所有系统上都有其他浏览器,其中所有上述功能都很好。

是否需要进行任何系统特定设置?还是我错过了任何重要的步骤?

谢谢大家。




When i run above code, On Mac it run as per required. On windows 7 It shows the video controls (Play button, seek bar ) but it could not play video. And on Windows xp X64 machine no video and video control visible.
Whats Wrong with windows 7 machine if it says that video tag and mp4( and H.264) is supported?
I have other browsers too on all system where all above works nicely.
Is there any system specific settings required? or did I miss any important step(s)?
Thanks all.

推荐答案

我觉得QApplication非常依赖于QT框架但不是你的浏览器。

我现在通过python语言使用QApplication打开页面,它适用于png,html,文本和任何其他格式,但在我尝试加载ogg声音时,QApplication和QWebView似乎没有工作。

然后,在我的电脑上,当然是同一个操作系统,我用chrome打开那个页面,它确实有声音,声音加载了js事件。



我也真的受此问题的困扰。我希望我能很快找到解决方案
I seems that QApplication very depends on QT framework but not your browser.
I am now open page by using QApplication by python language, it work for png,html,text and anyother format, but where I try to load ogg sound, the QApplication and QWebView seems not work.
Also then, on my computer, the same os of course, I used chrome to open that page, it did has sound,and sound loaded js event emitted.

I really suffer on this problem too. I wish I could figure out the solution very soon


这篇关于Qt5 QWebView HTML5视频标签支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆