Unsolved CMake Project Problem With MediaPlayer and VideoWidget
-
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);
-
Still I need a solution
-
@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)
-
@mehmety888 did not work
-
I still have the problem.
I have no problem about the Qt5.9, but I have a problem in Qt5.12