Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. CMake Project Problem With MediaPlayer and VideoWidget
Forum Updated to NodeBB v4.3 + New Features

CMake Project Problem With MediaPlayer and VideoWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.2k Views 1 Watching
  • 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.
  • D Offline
    D Offline
    DzCode
    wrote on last edited by DzCode
    #1

    Hi everyone,

    In QMake projet I have no problem about adding QMediaPlayer and QVideoWidget. However, If I try it in Cmake project I have got the warning below at runtime:

    defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"

    My widget is visible but does not play any audio or any video.
    I have added the below sections to cmake:

    find_package(Qt5 ${USED_QT_VERSION} REQUIRED COMPONENTS
        Core
        Widgets
        Svg
        Multimedia
        MultimediaWidgets
    )
    target_link_libraries(${PROJECT_NAME}
        WidgetsLib
        DataAccessLayer
        Qt5::Core
        Qt5::Widgets
        Qt5::Svg
        Qt5::Multimedia
        Qt5::MultimediaWidgets
    
    )
    

    Cpp code is like below:

    QHBoxLayout *p_horizontal_layout = new QHBoxLayout(this);
        QMediaPlayer *p_media_player = new QMediaPlayer(this);
        QVideoWidget *p_video_widget = new QVideoWidget(this);
        m_p_frame = new QFrame(this);
        m_p_frame->setLayout(p_horizontal_layout);
    
        p_media_player->setMedia(QUrl::fromLocalFile("C:/........./url.mp4")); 
        p_media_player->setVideoOutput(p_video_widget);
        m_p_frame->setGeometry(0,40,200,400);
        p_video_widget->show();
        m_media_player_list << p_media_player;
        m_video_widget_list << p_video_widget;
        p_horizontal_layout->addWidget(p_video_widget);
    
    1 Reply Last reply
    1
    • D Offline
      D Offline
      DzCode
      wrote on last edited by DzCode
      #2

      Still I need a solution

      M 1 Reply Last reply
      0
      • D DzCode

        Still I need a solution

        M Offline
        M Offline
        mehmety888
        wrote on last edited by
        #3

        @DzCode Could you try to add your cmakelists.txt following:

        SET(QT_USE_QTMULTIMEDIA TRUE)
        SET(QT_USE_QTMULTIMEDIAWIDGETS TRUE)
        ...
        QT5_USE_MODULES (${EXECUTABLE_NAME} Multimedia MultimediaWidgets)
        
        D 1 Reply Last reply
        0
        • M mehmety888

          @DzCode Could you try to add your cmakelists.txt following:

          SET(QT_USE_QTMULTIMEDIA TRUE)
          SET(QT_USE_QTMULTIMEDIAWIDGETS TRUE)
          ...
          QT5_USE_MODULES (${EXECUTABLE_NAME} Multimedia MultimediaWidgets)
          
          D Offline
          D Offline
          DzCode
          wrote on last edited by
          #4

          @mehmety888 did not work

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DzCode
            wrote on last edited by
            #5

            I still have the problem.

            I have no problem about the Qt5.9, but I have a problem in Qt5.12

            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