Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QMediaPlayer not working #226

Open
1 task done
kuepe-sl opened this issue Apr 12, 2022 · 3 comments
Open
1 task done

QMediaPlayer not working #226

kuepe-sl opened this issue Apr 12, 2022 · 3 comments
Labels

Comments

@kuepe-sl
Copy link

kuepe-sl commented Apr 12, 2022

Solution to issue cannot be found in the documentation.

  • I checked the documentation.

Issue

When trying to instantiate a QMediaPlayer object, I get the following error message:

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

Trying to play back a WAV or MP3 file results in silence.

Here is an example program that shows the error:

#!/usr/bin/env python3
import sys
import time
from PyQt5.QtCore import QUrl
from PyQt5.QtMultimedia import QMediaPlayer
from PyQt5.QtMultimedia import QMediaContent

file = QUrl.fromLocalFile(sys.argv[1])
media = QMediaContent(file)
player = QMediaPlayer()
player.setMedia(media)
player.setVolume(100)
player.play()

while player.state() != QMediaPlayer.StoppedState:
    time.sleep(1.0)

The program needs the packages: pyqt gst-plugins-good and can be run like this

python qtmedia-test.py file.wav

The same error and behaviour occours after compiling the official Qt Media Player Example using the Conda Qt toolchain and qmake.

EDIT: I just tried the script under Windows and I get the same issue there.

Installed packages

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
alsa-lib                  1.2.3                h516909a_0    conda-forge
brotli                    1.0.9                h166bdaf_7    conda-forge
brotli-bin                1.0.9                h166bdaf_7    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2021.10.8            ha878542_0    conda-forge
cmake                     3.23.0               h5432695_1    conda-forge
dbus                      1.13.6               h5008d03_3    conda-forge
expat                     2.4.8                h27087fc_0    conda-forge
fmt                       8.1.1                h4bd325d_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.14.0               h8e229c2_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
freetype                  2.10.4               h0708190_1    conda-forge
gettext                   0.19.8.1          h73d1719_1008    conda-forge
glib                      2.70.2               h780b84a_4    conda-forge
glib-networking           2.70.1               h3cf747a_0    conda-forge
glib-tools                2.70.2               h780b84a_4    conda-forge
gst-plugins-base          1.20.1               hcf0ee16_1    conda-forge
gst-plugins-good          1.20.1               h20dca43_1    conda-forge
gstreamer                 1.20.1               hd4edc92_1    conda-forge
icu                       69.1                 h9c3ff4c_0    conda-forge
jack                      1.9.18            hfd4fe87_1001    conda-forge
jpeg                      9e                   h7f98852_0    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
krb5                      1.19.3               h3790be6_0    conda-forge
lame                      3.100             h7f98852_1001    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
libbrotlicommon           1.0.9                h166bdaf_7    conda-forge
libbrotlidec              1.0.9                h166bdaf_7    conda-forge
libbrotlienc              1.0.9                h166bdaf_7    conda-forge
libclang                  13.0.1          default_hc23dcda_0    conda-forge
libcurl                   7.82.0               h7bff187_0    conda-forge
libdb                     6.2.32               h9c3ff4c_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libevent                  2.1.10               h9b69904_4    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libflac                   1.3.4                h27087fc_0    conda-forge
libgcc-ng                 11.2.0              h1d223b6_15    conda-forge
libglib                   2.70.2               h174f98d_4    conda-forge
libgomp                   11.2.0              h1d223b6_15    conda-forge
libiconv                  1.16                 h516909a_0    conda-forge
libllvm13                 13.0.1               hf817b99_2    conda-forge
libnghttp2                1.47.0               h727a467_0    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libogg                    1.3.4                h7f98852_1    conda-forge
libopus                   1.3.1                h7f98852_1    conda-forge
libpng                    1.6.37               h21135ba_2    conda-forge
libpq                     14.2                 hd57d9b9_0    conda-forge
libpsl                    0.21.1               he07bd03_4    conda-forge
libsndfile                1.0.31               h9c3ff4c_1    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libsoup                   2.74.1               hdd0e21f_0    conda-forge
libssh2                   1.10.0               ha56f1ee_2    conda-forge
libstdcxx-ng              11.2.0              he4da1e4_15    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libuv                     1.43.0               h7f98852_0    conda-forge
libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
libxcb                    1.13              h7f98852_1004    conda-forge
libxkbcommon              1.0.3                he3ba5ed_0    conda-forge
libxml2                   2.9.12               h885dcf4_1    conda-forge
libzlib                   1.2.11            h166bdaf_1014    conda-forge
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
mysql-common              8.0.28               haf5c9bc_3    conda-forge
mysql-libs                8.0.28               h28c427c_3    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
nspr                      4.32                 h9c3ff4c_1    conda-forge
nss                       3.77                 h2350873_0    conda-forge
openssl                   1.1.1n               h166bdaf_0    conda-forge
pcre                      8.45                 h9c3ff4c_0    conda-forge
pip                       22.0.4             pyhd8ed1ab_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
pyqt                      5.12.3           py39hf3d152e_8    conda-forge
pyqt-impl                 5.12.3           py39hde8b62d_8    conda-forge
pyqt5-sip                 4.19.18          py39he80948d_8    conda-forge
pyqtchart                 5.12             py39h0fcd23e_8    conda-forge
pyqtwebengine             5.12.1           py39h0fcd23e_8    conda-forge
python                    3.9.12          h9a8a25e_1_cpython    conda-forge
python_abi                3.9                      2_cp39    conda-forge
qt                        5.12.9               h1304e3e_6    conda-forge
readline                  8.1                  h46c0cb4_0    conda-forge
rhash                     1.4.1                h7f98852_0    conda-forge
setuptools                62.1.0           py39hf3d152e_0    conda-forge
sqlite                    3.38.2               h4ff8645_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
tzdata                    2022a                h191b570_0    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
zlib                      1.2.11            h166bdaf_1014    conda-forge
zstd                      1.5.2                ha95c52a_0    conda-forge

Environment info

active environment : qt-media
    active env location : /home/user/miniconda3/envs/qt-media
            shell level : 2
       user config file : /home/user/.condarc
 populated config files : /home/user/.condarc
          conda version : 4.12.0
    conda-build version : 3.21.8
         python version : 3.8.13.final.0
       virtual packages : __linux=5.13.0=0
                          __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/user/miniconda3  (writable)
      conda av data dir : /home/user/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/user/miniconda3/pkgs
                          /home/user/.conda/pkgs
       envs directories : /home/user/miniconda3/envs
                          /home/user/.conda/envs
               platform : linux-64
             user-agent : conda/4.12.0 requests/2.27.1 CPython/3.8.13 Linux/5.13.0-30-generic ubuntu/20.04.4 glibc/2.31
                UID:GID : 1000:1000
             netrc file : /home/user/.netrc
           offline mode : False
@kuepe-sl kuepe-sl added the bug label Apr 12, 2022
@kuepe-sl kuepe-sl changed the title QMediaPlayer not working under Linux QMediaPlayer not working Apr 12, 2022
@kuepe-sl
Copy link
Author

I just noticed that the file <ROOT>/plugins/mediaservice/libgstmediaplayer.so is missing in the package.
The file was present in qt 5.12.9, build 4 (linux64), but it went missing in build 5. (MR #214)

By installing qt=5.12.9=hda022c4_4, the error message vanishes unter Linux. It appears to play the file back (player.state() returns 1), but without audio.
mamba install -c dtk-forge gst-plugins-good-pulseaudio eventually gives me audio.


The error ("no service found") persists under Windows even with build 4.

@andfoy
Copy link

andfoy commented Apr 22, 2022

Did you compile PyQt using the qt-main package? There are no PyQt packages available: conda-forge/pyqt-feedstock#107

@kuepe-sl
Copy link
Author

I used the existing pyqt package.
However the pyqt package doesn't seem to be version-pinned, so it ends up installing v5.12.3:

pyqt                      5.12.3           py39hf3d152e_8    conda-forge

This version of pyqt worked fine enough for testing. I assumed a small Python script would be easier to test than a full C++ project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants