Results 1 to 7 of 7

Thread: QWebView does not display a video

  1. #1
    Join Date
    Sep 2008
    Location
    Poland
    Posts
    80
    Thanks
    4
    Thanked 5 Times in 4 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default QWebView does not display a video

    Hello

    I've a local page which contains several video objects:
    Qt Code:
    1. <!DOCTYPE html>
    2. <html>
    3. <head>
    4. <meta charset="utf-8" />
    5. <title>HTML5 Video Player</title>
    6. </head>
    7. <body>
    8. A message
    9. <div >
    10. <object width="400" height="400" data="big_buck_bunny.mp4" controls="0"></object>
    11. <object width="400" height="400" data="Robotica_720.wmv" controls="0"></object>
    12. <object width="400" height="400" data="ArchitectVideo_dvd.ogv" controls="0"></object>
    13. </div>
    14. </body>
    15. </html>
    To copy to clipboard, switch view to plain text mode 

    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
    Last edited by MasterBLB; 14th January 2015 at 12:35.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWebView does not display a video

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2008
    Location
    Poland
    Posts
    80
    Thanks
    4
    Thanked 5 Times in 4 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: QWebView does not display a video

    That's true Wysota,but I did the above because <video> tag seems to not working too.

    Qt Code:
    1. <!-- <video controls>
    2. <source src="ArchitectVideo_dvd.ogv" type="video/ogg">
    3. </video> -->
    To copy to clipboard, switch view to plain text mode 

    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.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWebView does not display a video

    Quote Originally Posted by MasterBLB View Post
    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:

    Qt Code:
    1. #include <QtWidgets>
    2. #include <QWebView>
    3.  
    4. int main(int argc, char **argv) {
    5. QApplication app(argc, argv);
    6. QWebView view;
    7. view.setUrl(QUrl::fromLocalFile("/tmp/vi/main.html"));
    8. view.show();
    9. return app.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

    html Code:
    1. <html>
    2. <body>
    3. <video width="1920" height="1080" controls>
    4. <source src="http://mirrorblender.top-ix.org/peach/bigbuckbunny_movies/big_buck_bunny_1080p_surround.avi" type="video/mp4"/>
    5. </video>
    6. </body>
    7. </html>
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Sep 2008
    Location
    Poland
    Posts
    80
    Thanks
    4
    Thanked 5 Times in 4 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: QWebView does not display a video

    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.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWebView does not display a video

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Sep 2008
    Location
    Poland
    Posts
    80
    Thanks
    4
    Thanked 5 Times in 4 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: QWebView does not display a video

    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:
    2lsxkls.jpg
    Last edited by MasterBLB; 14th January 2015 at 14:48.

Similar Threads

  1. Display video in a GUI
    By aguleo in forum Newbie
    Replies: 3
    Last Post: 31st May 2013, 21:51
  2. Qt video display
    By ganeshgladish in forum Newbie
    Replies: 7
    Last Post: 6th February 2013, 18:42
  3. how to display video at a certain time?
    By cic in forum Qt Programming
    Replies: 1
    Last Post: 17th November 2011, 13:01
  4. In which component can I display video?
    By punkypogo in forum Qt Programming
    Replies: 4
    Last Post: 16th July 2010, 17:40
  5. Reg QWebview Display
    By Tavit in forum Qt Programming
    Replies: 0
    Last Post: 5th August 2009, 16:19

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.