PDA

View Full Version : QWebView does not display a video



MasterBLB
14th January 2015, 12:15
Hello

I've a local page which contains several video objects:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML5 Video Player</title>
</head>
<body>
A message
<div >
<object width="400" height="400" data="big_buck_bunny.mp4" controls="0"></object>
<object width="400" height="400" data="Robotica_720.wmv" controls="0"></object>
<object width="400" height="400" data="ArchitectVideo_dvd.ogv" controls="0"></object>
</div>
</body>
</html>

I have plugins enabled for my QWebView,but in it I don't see the movies but icon similar to those in browsers indicating a plugin is missing.

Can anyone give me a hint what I need to display the vids?

Qt 5.3 32bit,VS2013 with Add-on

wysota
14th January 2015, 13:32
Correct me if I'm wrong but for HTML5 you should use a <video> tag and not <object>. Otherwise you would be playing the video via a plugin.

MasterBLB
14th January 2015, 13:36
That's true Wysota,but I did the above because <video> tag seems to not working too.


<!-- <video controls>
<source src="ArchitectVideo_dvd.ogv" type="video/ogg">
</video> -->

This is how my code was during 1st attempt to play a video in QWebView.
Also,from what I know there will be issues to play .avi files via <video> tag,and that possibility is highly demanded in my application.

wysota
14th January 2015, 13:48
Also,from what I know there will be issues to play .avi files via <video> tag,and that possibility is highly demanded in my application.
You'll be having issues in playing them (and all other) with the plugin api if you don't have a working plugin too.

This works for me without problems:


#include <QtWidgets>
#include <QWebView>

int main(int argc, char **argv) {
QApplication app(argc, argv);
QWebView view;
view.setUrl(QUrl::fromLocalFile("/tmp/vi/main.html"));
view.show();
return app.exec();
}

<html>
<body>
<video width="1920" height="1080" controls>
<source src="http://mirrorblender.top-ix.org/peach/bigbuckbunny_movies/big_buck_bunny_1080p_surround.avi" type="video/mp4"/>
</video>
</body>
</html>

MasterBLB
14th January 2015, 14:04
Unfortunately,for me it does not.
Also,when I try to open the html in a browser (opera 12.17 and IE 11) it does not work too.

wysota
14th January 2015, 14:07
Tough luck, it's valid html5 code. You should at least get the (probably black) player rectangle, even if your browser cannot play the movie. You can replace the avi with some other format and try again.

MasterBLB
14th January 2015, 14:48
Yes,that's is - I have a player object,but nothing happens when I hit play.
And that's the result for all video types.

Added after 29 minutes:

This is how it looks:
10884