UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Audio Player:The QMediaPlayer object does not have a valid service

    Scheduled Pinned Locked Moved App Development
    17 Posts 4 Posters 6.9k Views 2 Watching
    Loading More Posts
    • 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.
      • W Offline
        wdehoog
        last edited by

        Hi,

        I am trying to develop an app (qml only) using the Audio object (QtMultimedia 5.5). Now I get this error:

        Audio Player:The QMediaPlayer object does not have a valid service

        what does it mean and how can I solve it?

        1 Reply Last reply Reply Quote 0
        • V Offline
          vadrian89
          last edited by

          @wdehoog said in Audio Player:The QMediaPlayer object does not have a valid service:

          Player:The QMediaPlayer object does not have a valid service

          Check if the this help, it seems it might be related to gstreamer.
          Installing gstreamer-devel might help, as it seems in that topic.

          1 Reply Last reply Reply Quote 0
          • W Offline
            wdehoog
            last edited by

            It looks like apparmor is unhappy. Still no idea how to fix it.
            I added networking, audio and video but it is still not allowed.

            from the cache/upstart/ log:

            virtual QMediaService* AalServicePlugin::create(const QString&) "org.qt-project.qt.mediaplayer"
            [TT 2017-11-12 11:31:32.904333] [service.cpp:29@instance]
            Failed to start a new media-hub player session: org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.77286" (uid=32011 pid=3801 comm="/usr/lib/arm-linux-gnueabihf/qt5/bin/qmlscene shou") interface="core.ubuntu.media.Service" member="CreateSession" error name="(unset)" requested_reply="0" destination="core.ubuntu.media.Service" (uid=32011 pid=3132 comm="media-hub-server ")
            Failed to create a new media player backend. Video playback will not function.

            Could not finish contructing new AalMediaPlayerService instance since m_hubPlayerSession is NULL
            virtual void QDeclarativeAudio::componentComplete()
            qml: shoutcast-ubports
            QNetworkManagerInterface::QNetworkManagerInterface(QObject*) propsReply "An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.29030" (uid=32011 pid=3801 comm="/usr/lib/arm-linux-gnueabihf/qt5/bin/qmlscene shou") interface="org.freedesktop.DBus.Properties" member="GetAll" error name="(unset)" requested_reply="0" destination="org.freedesktop.NetworkManager" (uid=0 pid=2023 comm="NetworkManager ")"
            QNetworkManagerInterface::QNetworkManagerInterface(QObject*) nmReply "An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.29030" (uid=32011 pid=3801 comm="/usr/lib/arm-linux-gnueabihf/qt5/bin/qmlscene shou") interface="org.freedesktop.NetworkManager" member="GetDevices" error name="(unset)" requested_reply="0" destination="org.freedesktop.NetworkManager" (uid=0 pid=2023 comm="NetworkManager ")"
            "Object path cannot be empty"
            library "/vendor/lib/egl/libGLESv2S3D_adreno.so" not found

            1 Reply Last reply Reply Quote 0
            • W Offline
              wdehoog
              last edited by

              After disabling apparmor (modified linux commandline in boot.img, apparmor=0 security="") these errprs are gone.

              Now the errors are:

              setMedia() media: QUrl( "http://144.217.49.251:80/stream1" )
              virtual QMediaPlayer::MediaStatus AalMediaPlayerControl::mediaStatus() const

              Setting media to: QUrl( "http://144.217.49.251:80/stream1" )
              Failed to set media QUrl( "http://144.217.49.251:80/stream1" ) : org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

              Can't the media thing behind the qml Audio item handle http url's? wget can handle this adres on the phone.

              1 Reply Last reply Reply Quote 0
              • W Offline
                wdehoog
                last edited by

                When completely disabling apparmor even the music app cannot play anmore. So back to apparmor.

                As explained here https://wiki.ubuntu.com/Touch/DeprecatedPorting one can disable it for click apps (application-click.conf). When I do that Audio works.

                Now I'd like to know how to detect which policy denies my app to play audio so I can add this to the apparmor file.

                1 Reply Last reply Reply Quote 0
                • S Offline
                  stefwe
                  last edited by

                  I don't know anything about apparmor.

                  Did it help you to check the apparmor file from other programms? How they handle this?

                  https://open.uappexplorer.com/app/utmedia.nfsprodriver

                  https://github.com/nfsprodriver/UTmedia/blob/master/UTmedia.apparmor

                  Meizu MX4 16.04 | Nexus 5 16.04

                  W 1 Reply Last reply Reply Quote 0
                  • W Offline
                    wdehoog @stefwe
                    last edited by

                    @Einstein212 thanks. UTmedia does work on my phone but when I copy it's apparmor stuff it does not help. Maybe because UTmedia is a webapp and mine is qml.

                    Even if I add all policies in the IDE still using Audio is DENIED.

                    Could it be the way I install it?
                    I use 'pkcon --allow-untrusted install-local'.

                    D 1 Reply Last reply Reply Quote 0
                    • W Offline
                      wdehoog
                      last edited by

                      It appears that when installing my click app there is a apparmor profile being made in /var/lib/apparmor/profiles/. It also appears none of the policies I added are being addressed in the generated profile.

                      I edited the generated profile and added

                      #include <abstractions/audio>
                      #include <abstractions/dbus-strict>
                      #include <abstractions/dbus-session-strict>

                      reloaded the profile and now the Audio tag works.

                      So how is this ever supposed to work?

                      1 Reply Last reply Reply Quote 0
                      • W Offline
                        wdehoog
                        last edited by wdehoog

                        sorry that should have been:

                        #include <abstractions/audio>
                        #include <abstractions/dbus>
                        #include <abstractions/dbus-session>

                        the -strict ones did not help

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          doniks @wdehoog
                          last edited by

                          @wdehoog said in Audio Player:The QMediaPlayer object does not have a valid service:

                          @Einstein212 thanks. UTmedia does work on my phone but when I copy it's apparmor stuff it does not help. Maybe because UTmedia is a webapp and mine is qml.

                          Maybe you can find another open source, UT, audio app that is qml to check

                          1 Reply Last reply Reply Quote 0
                          • W Offline
                            wdehoog
                            last edited by wdehoog

                            Installing my click using 'pkcon...' generates a different profile file then when done manually (aa-clicktool & aa-easyprof see https://wiki.ubuntu.com/SecurityTeam/Specifications/ApplicationConfinement/Manifest). The manual way adds extra rules that allow the app to use the media-hub.

                            I noticed that uninstalling the app did not remove the profile. Manually removing the profile (from /var/lib/apparmor/profiles and from /var/cache/apparmor/) and then reinstalling the click resulted in a profile that could actually work.

                            After loading it (apparmor_parser -r) my app works!

                            So I think that after adding the policies in the IDE and installing the new click the previous profile (without the policies) was still being used. Question is why? Maybe because the profiles are cached and I did not increase the version number of my app.

                            W 1 Reply Last reply Reply Quote 1
                            • W Offline
                              wdehoog @wdehoog
                              last edited by

                              First and maybe only release of the app is now available here: shoutcast-ubports.wdehoog_0.1_all.click

                              It is a shoutcast browser and player. Sources and screenshots are on github

                              Please give it a try. I only tested it on my moto g 2nd (thank you walidham) but like to know if it works on other devices before submitting it to the OpenStore.

                              S 1 Reply Last reply Reply Quote 1
                              • S Offline
                                stefwe @wdehoog
                                last edited by

                                @wdehoog I download and install the click package. But i don't get an icon on my home screen to start your program

                                Do you think it is hard work to get a program made for soundcloud?

                                Meizu MX4 16.04 | Nexus 5 16.04

                                W 1 Reply Last reply Reply Quote 0
                                • W Offline
                                  wdehoog @stefwe
                                  last edited by

                                  @Einstein212 did the icon not appear after refreshing home (pull down to refresh)?

                                  Does soundcloud have an API to browse/search and retrieve lists?

                                  S 1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    stefwe @wdehoog
                                    last edited by

                                    @wdehoog now i did a refresh and it's there. Nice work. Rock Antenne is running 🙂

                                    https://developers.soundcloud.com/ here are some infos for developer, but i don't have api experience to say this informations makes it possible to build a programm around this.

                                    Meizu MX4 16.04 | Nexus 5 16.04

                                    W 1 Reply Last reply Reply Quote 0
                                    • W Offline
                                      wdehoog @stefwe
                                      last edited by

                                      @Einstein212 I did not know about soundcloud and now see that it supports a lot of features. It will be no small effort. As it is of no use to me I am not going to work on it. If you are a developer yourself and need help I might be of use.

                                      There is a project on github that could be of interest to you https://github.com/lukedirtwalker/musikloud2 looks like a soundcloud client for sailfish maybe parts can be used for a ubports app.

                                      S 1 Reply Last reply Reply Quote 0
                                      • S Offline
                                        stefwe @wdehoog
                                        last edited by

                                        @wdehoog i'd love to develop stuff for ubports, but my skills not good enough. Also i have not so much free time at the moment to lern something 😞

                                        Thanks for the link, i will take a look on the code.

                                        Meizu MX4 16.04 | Nexus 5 16.04

                                        1 Reply Last reply Reply Quote 0
                                        • First post
                                          Last post