Results 1 to 3 of 3

Thread: Vlc browser plugin (npapi-vlc) does not load in Qt Webkit browser

  1. #1
    Join Date
    Apr 2013
    Location
    milan
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Vlc browser plugin (npapi-vlc) does not load in Qt Webkit browser

    I'm having problem to make the browser load the vlc plugin I've an html page that has this code inside:

    Qt Code:
    1. <OBJECT type="applications/x-vlc-plugin" classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"
    2.  
    3. codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,6,0"
    4. width="640"
    5. height="480"
    6. id="vlc"
    7. version="VideoLAN.VLCPlugin.2">
    8. <param name="MRL" id="mrlid" value="rtsp://***********" />
    9. <param name="ShowDisplay" value="True" />
    10. <param name="AutoLoop" value="False" />
    11. <param name="AutoPlay" value="False" />
    12. <param name="Volume" value="50" />
    13. <param name="StartTime" value="0" />
    14. <EMBED pluginspage="http://www.videolan.org" type="application/x-vlc-plugin" progid="VideoLAN.VLCPlugin.2" width="640" height="480" name="vlce"></EMBED>
    15. </OBJECT>
    To copy to clipboard, switch view to plain text mode 

    Instead of a movie I simply obtain a weird blue cube with '?' inside... no error, no debug anything...

    I think to have enabled plugins in all possibles ways:

    I've added in the QApplication ctor this code:

    Qt Code:
    1. QWebSettings *settings = QWebSettings::globalSettings();
    2. settings->setAttribute(QWebSettings::JavascriptEnabled, true);
    3. settings->setAttribute(QWebSettings::PluginsEnabled, true);
    To copy to clipboard, switch view to plain text mode 

    I've done this in any QWebView that is created too...

    Another thing I've tried is to force Qt to search plugins where npapi-vlc is installed doing in this way:

    Qt Code:
    1. QCoreApplication::addLibraryPath("/usr/lib64/mozilla/plugins/");
    To copy to clipboard, switch view to plain text mode 

    and I continue to get a cube instead of a movie

    What is the trick? There is some strange file to edit in some weird place to enable / disable some security that is blocking it?

    The version of Qt I'm using is 5.6.1-3.

    Please help me.

    Thank you!

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,534
    Thanks
    13
    Thanked 1,576 Times in 1,505 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Vlc browser plugin (npapi-vlc) does not load in Qt Webkit browser

    I am not sure that it is reasonable to expect an ActiveX component, i.e. developed for Windows and very dependent on things like the registry, to work in a Linux/UNIX environment.

  3. #3
    Join Date
    Apr 2013
    Location
    milan
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Vlc browser plugin (npapi-vlc) does not load in Qt Webkit browser

    It is not an ActiveX component (?) it a normal plug in and it is Linux native code, web kit should use the NPAPI instead to show cubes

    By the way I'm now trying to write my simple MediaPlayer starting from this example: http://doc.qt.io/archives/qt-4.8/qt-...n-example.html

    The example works correctly so effectively the QtWebkit supports plugins but for some reasons it does not like VLC

    This my simple html page:

    Qt Code:
    1. <object type="video/mjpeg"
    2. data="http://***/httppreview"
    3. width="100%" height="400"></object>
    To copy to clipboard, switch view to plain text mode 

    my factory:

    Qt Code:
    1. mediaPlayerFactory::mediaPlayerFactory(QObject *parent)
    2. : QWebPluginFactory(parent)
    3. {
    4. manager = new QNetworkAccessManager(this);
    5. };
    6.  
    7. QObject *mediaPlayerFactory::create(const QString &mimeType, const QUrl &url,
    8. const QStringList &argumentNames,
    9. const QStringList &argumentValues) const
    10. {
    11. if (mimeType != "video/mjpeg")
    12. return 0;
    13.  
    14. //mediaPlayerView *view = new mediaPlayerView(argumentValues[argumentNames.indexOf("type")]);
    15. mediaPlayerView *view = new mediaPlayerView(url);
    16.  
    17. QNetworkRequest request(url);
    18. QNetworkReply *reply = manager->get(request);
    19. connect(reply, SIGNAL(readyRead()), view, SLOT(onReadyRead(reply)));
    20. connect(reply,SIGNAL(error(QNetworkReply::NetworkError)),
    21. view,SLOT(onError(QNetworkReply::NetworkError)));
    22.  
    23. //connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater()));
    24.  
    25. return view;
    26. }
    27.  
    28. QList<QWebPluginFactory::Plugin> mediaPlayerFactory::plugins() const
    29. {
    30. QWebPluginFactory::MimeType mimeType;
    31. mimeType.name = "video/mjpeg";
    32. mimeType.description = "MediaPlayer";
    33. mimeType.fileExtensions = QStringList() << "mjpeg";
    34.  
    35. QWebPluginFactory::Plugin plugin;
    36. plugin.name = "MediaPlayer";
    37. plugin.description = "A MediaPlayer Web plugin.";
    38. plugin.mimeTypes = QList<MimeType>() << mimeType;
    39.  
    40. return QList<QWebPluginFactory::Plugin>() << plugin;
    41. }
    To copy to clipboard, switch view to plain text mode 

    My MediaplayerView:

    Qt Code:
    1. mediaPlayerView::mediaPlayerView(const QUrl &url, QWidget *parent)
    2. : QWidget(parent)
    3. {
    4. this->url = url;
    5.  
    6. Log("Getting MJPEG stream from url: " + url.toString());
    7.  
    8. label = new QLabel(this);
    9.  
    10. label->setWindowFlags(label->windowFlags() | Qt::FramelessWindowHint);
    11. label->show();
    12.  
    13. Log("Ready to stream!");
    14. }
    To copy to clipboard, switch view to plain text mode 


    and I'm dead already! I never get the readyRead() signal!

    The thing that I do not understand is why it is working correctly in a normal standalone application?
    Inside onReadyRead() I process the image and display it in the Label 'label' I think it is not relevant as it is never called

    Any ideas?

    The ctor of mediaPlayerView is called the connections seem estabilished too:

    Qt Code:
    1. ss -nap | grep 7171
    2. ESTAB 0 0 ***:43506 ***:80 users:(("****",7171,23))
    To copy to clipboard, switch view to plain text mode 

    The camera shows the stream if you connect to its port 80, all very simple for me...


    Added after 39 minutes:


    I've found the problem!

    I've forgotten that Qt makes in some way C++ a dynamic language in the sense that the program can now fails at runtime too.

    The error was in the readyRead() connect it seems Qt does not like that the slot has a different prototype... readyRead() has no arguments but onReadyRead() wanted a QtNetworkReply * as argument... all compiled perfectly but an error was written on stderr:

    QObject::connect: No such slot mediaPlayerView:nReadyRead(reply) in src/mediaPlayerFactory.cpp:25
    Luckily I can "recover" Reply on the onReadyRead() simply doing:

    Qt Code:
    1. QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
    To copy to clipboard, switch view to plain text mode 

    It is working now but I've not understood how all the memory allocated with "new" is freed... I fear my next problem will be memory leak
    Last edited by fanoI; 14th November 2018 at 11:12.

Similar Threads

  1. run example qt5.1.1 browser on arm (qt-5.1.1/examples/webkitwidgets/browser/browser)
    By soumya pandiyattu in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 8th December 2014, 07:47
  2. QT WebKit - Browser Interaction Problem
    By s7 in forum Qt Programming
    Replies: 10
    Last Post: 22nd May 2012, 16:51
  3. Handling multiple web pages in Qt WebKit Browser
    By dpen41 in forum Qt Programming
    Replies: 6
    Last Post: 7th February 2012, 21:15
  4. Replies: 0
    Last Post: 17th March 2011, 03:17
  5. Not able to run fancy browser and demo browser example applications
    By GoGetIt in forum Installation and Deployment
    Replies: 1
    Last Post: 16th August 2010, 06:23

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.