Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. Qt Webengine featurePermissionRequested signal not emitted
Qt 6.11 is out! See what's new in the release blog

Qt Webengine featurePermissionRequested signal not emitted

Scheduled Pinned Locked Moved Unsolved QtWebEngine
4 Posts 3 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    haris123
    wrote on last edited by haris123
    #1

    I am trying to load a page https://webrtc.github.io/samples/src/content/getusermedia/getdisplaymedia which do WebRTC screen sharing,

    And I have to apply permission to capture the desktop using the code

    webPage->setFeaturePermission(QUrl(url), QWebEnginePage::DesktopVideoCapture, QWebEnginePage::PermissionGrantedByUser);
    

    And the doc here https://doc.qt.io/qt-5/qwebenginepage.html#setFeaturePermission says I can call it when the signal featurePermissionRequested emitted. I have connect the signal with a slot but it's not getting called when I load the page.

    I am getting following error when try to capture the screen

    [2228:3460:0424/114301.567:INFO:CONSOLE(74)] "Start capturing.", source: https://webrtc.github.io/samples/src/content/getusermedia/getdisplaymedia/js/main.js (74)
    js: Uncaught (in promise) NotAllowedError: Invalid state
    [2228:3460:0424/114301.599:INFO:CONSOLE(99)] "Uncaught (in promise) NotAllowedError: Invalid state", source: https://webrtc.github.io/samples/src/content/getusermedia/getdisplaymedia/js/main.js (99)
    

    Here is the code

        QString  url ="https://webrtc.github.io/samples/src/content/getusermedia/getdisplaymedia/";
        QWebEngineView *webEngineView =  new QWebEngineView(parent);
        webEngineView->load(QUrl(url));
        webEngineView->show();
        connect(webEngineView->page(), SIGNAL(featurePermissionRequested(const QUrl&, 
        QWebEnginePage::Feature)), this,SLOT(featurePermissionRequestedSlot(const QUrl&, QWebEnginePage::Feature)));
    

    When I click start screen capture the slot featurePermissionRequestedSlot not called, what could be the reason.

    1 Reply Last reply
    0
    • eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by
      #2

      @haris123 This page uses getDisplayMedia() but that is not supported by QtWebEngine, and I think that is the cause of the error. Try this page "https://test.webrtc.org/" and this code: https://stackoverflow.com/a/49312976/6622587

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        haris123
        wrote on last edited by haris123
        #3

        @eyllanesc Thanks for the feed, basically I need to create a screen sharing application using Qt, I found that the webRTC has the functionality for that, the client will access the screen using browser, but in server PC(screen sharing PC) I need to do using QT. Is there any other way.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jun CH
          wrote on last edited by
          #4

          Can try:

          QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::ScreenCaptureEnabled, true);
          
          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved