December 28, 2011

AllenYC AllenYC
Lab Rat
3 posts

Any ways for QtWebKit playing HTML5 video without installing flash player

 

I know that QtWebKit-2.2 is supposed to support for HTML5 media (audio/video), but not now.
http://developer.qt.nokia.com/forums/viewthread/11865

Therefore I tried Qt4.7.4 with simple code below.
According to “http://www.youtube.com/html5”, my example browser supports “Video tag” and “H.264”. I thought that means I do not need to enable flash plugins to play youtube videos. But I was wrong; appending “&html5=True” to the video’s address does not work at all.

Is there any code missing or should I enable anything to play youtube video without using the flash plugin?

Here is my code:

  1. int main(int argc, char *argv[])
  2. {
  3.  
  4.   QApplication a(argc, argv);
  5.  
  6.   //QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
  7.  
  8.   QWebView *view = new QWebView();
  9.   view->load(QUrl("http://www.youtube.com/watch?v=cTl3U6aSd2w&html5=True"));
  10.   view->show();
  11.   return a.exec();
  12.  }

Thanks

13 replies

March 26, 2012

xulinguestc xulinguestc
Lab Rat
5 posts

it looks like that qtwebkit cann’t support video tag now ~~

August 30, 2012

iTwice iTwice
Lab Rat
6 posts

I have Windows 7 Ultimate x86 and Qt 4.8.1. But it cannot play html5 video in QWebView widget. So how can I do this?

August 30, 2012

iTwice iTwice
Lab Rat
6 posts
xulinguestc wrote:
it looks like that qtwebkit cann’t support video tag now ~~

hmm, but it must http://trac.webkit.org/wiki/QtWebKitFeatures22#WebDeveloperFeatures

August 30, 2012

guziemic guziemic
Lab Rat
120 posts

As far as I know, WebKit supports video tag. In case of Linux it uses GStreamer to display video content.
You can check if your browser supports it with
HTML5 Test [html5test.com]

August 30, 2012

iTwice iTwice
Lab Rat
6 posts
guziemic wrote:
As far as I know, WebKit supports video tag. In case of Linux it uses GStreamer to display video content. You can check if your browser supports it with HTML5 Test [html5test.com]

I checked through QWebView and there isn’t support in audio/video (But there is on Google Chrome which uses WebKit too). And what is it using on Windows? Maybe I need install something?

August 30, 2012

Peppy Peppy
Lab Rat
412 posts

Please wait till new version of QtWebKit module will be released, although these versions should handle HTML5 video/audio, there are some issues (I don’t remember which…)…In order to really have included HTML5 video/audio try Qt 4.8.2 or Qt 5.0 Beta libraries.

August 31, 2012

iTwice iTwice
Lab Rat
6 posts

I tried with Qt 5.0 beta but it’s not help..

August 31, 2012

Peppy Peppy
Lab Rat
412 posts

Neither Qt 5.0 beta does not handle HTML5 video/audio? That’s really strange. Hmm… may it be caused by not working multimedia plugin? (I think, this makes problems)….

August 31, 2012

iTwice iTwice
Lab Rat
6 posts
Peppy wrote:
Neither Qt 5.0 beta does not handle HTML5 video/audio? That’s really strange. Hmm… may it be caused by not working multimedia plugin? (I think, this makes problems)….

I think this trouble only on Windows (and maybe on Mac). One guy on irc channel answered me that “<tronical> Twice: sorry, it’s not implemented on Windows :(”
So I don’t know what to do with my program which must view local html5-files.. So maybe I need to migrate from qt..

P.S: what multimedia plugin?

August 31, 2012

Peppy Peppy
Lab Rat
412 posts

Multimedia plugin handles Audio/Video, so I though, it was caused by that plugin, which does not work now.

And does he said something more, or not? Why it is so…

August 31, 2012

iTwice iTwice
Lab Rat
6 posts

“<Twice> hi, do you know why it’s not implemented on Windows?
<tronical> it’s a rather complicated piece that’s simply not been written yet
<tronical> sadly there is no backend in webkit that can easily be re-used
<Twice> are you Qt developer or you know you just know it?
<tronical> I’m a Qt developer
<Twice> so I can’t use Qt for building cross-platform html5-viewer?
<tronical> indeed, I’m afraid you can’t use Qt very well for that right now
<Twice> and will it be in Qt 5.0 final release or you dont know?
<tronical> I’m pretty sure it won’t be in the final Qt 5.0.0 release”

August 31, 2012

guziemic guziemic
Lab Rat
120 posts

In addition, with Qt 5 you will have possibility to use WebKit2 with has different API and different process management than already know WebKit1 with is in Qt 4.X
That really make things more complicated ,especially when you get used to old API that pretty well expose all WebKit elements to Qt world.

August 31, 2012

Peppy Peppy
Lab Rat
412 posts

So there you go. HTML 5 vids are not “possible” for now. Maybe using platform-depend core to play videos, just write Qt wrapper for

- iOS – Safari (WebKit Core) – Android – Chrome (WebKit Core) – Windows (Phone) – MSIE – Trident Core

 
  ‹‹ how to let qtwebkit support html5 audio tag in windowsxp?      Can we port QWebKit application to iPad ››

You must log in to post a reply. Not a member yet? Register here!