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

    Python should reset PulseAudio

    Scheduled Pinned Locked Moved App Development
    25 Posts 4 Posters 3.8k 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.
      • D Offline
        digi6622 @arubislander
        last edited by

        @arubislander

        Maybe slide I to my DM's to talk it through?

        That would be really nice !
        In short words what my app should do:

        • Select a certain number of minutes (it already works)

        • Go to sleep for the number of minutes (works too)

        • After this time the app close media-hub or decrease volume of this soundchannel or mute pulseaudio (= my problem)

        arubislanderA 1 Reply Last reply Reply Quote 0
        • arubislanderA Offline
          arubislander @digi6622
          last edited by

          @digi6622 and is using Python a hard requirement?

          πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
          Happily running Ubuntu Touch
          Google Pixel 3a (20.04 DEV)
          JingPad (24.04 preview)
          Meizu Pro 5 (16.04 DEV)

          D 1 Reply Last reply Reply Quote 0
          • D Offline
            digi6622 @arubislander
            last edited by

            @arubislander said in Python should reset PulseAudio:

            @digi6622 and is using Python a hard requirement?

            It would be nice if possible. I'm not fit in C++ or other codings.

            arubislanderA 1 Reply Last reply Reply Quote 0
            • arubislanderA Offline
              arubislander @digi6622
              last edited by

              @digi6622 I ask because for what you want to do, you probably o ly need QML and some Javascript.

              πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
              Happily running Ubuntu Touch
              Google Pixel 3a (20.04 DEV)
              JingPad (24.04 preview)
              Meizu Pro 5 (16.04 DEV)

              D 1 Reply Last reply Reply Quote 0
              • D Offline
                digi6622 @arubislander
                last edited by

                @arubislander
                QML and Javascript are okay.

                arubislanderA 1 Reply Last reply Reply Quote 0
                • arubislanderA Offline
                  arubislander @digi6622
                  last edited by arubislander

                  @digi6622 I have prepared a code snippet that does what you want. The Main.qml references silence.wav, which is a one second of silence wav file in the assets folder, created with Audacity. When the button is clicked the wav file is played, interrupting and superceding anything else that might have been playing.

                  Don't forget to add the "multimedia" profile to your apparmor file (appname.apparmor).

                  This can be run in a confined app, and does not require trying to manipulate commands and services external to the application.

                  I would like to reiterate that, as a proof of concept and by way of exercise, this is all very well. But a proper sleep functionality should be either implemented in the OS somewhere, as a global feature (maybe in settings?), or in the Music app itself as a local feature.

                  πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
                  Happily running Ubuntu Touch
                  Google Pixel 3a (20.04 DEV)
                  JingPad (24.04 preview)
                  Meizu Pro 5 (16.04 DEV)

                  D 1 Reply Last reply Reply Quote 1
                  • D Offline
                    digi6622 @arubislander
                    last edited by

                    @arubislander
                    Thanks again !!!
                    It sounds very simple. Actually, I had assumed that the sound outputs (media-hub and playing a wav-file) were on different sound slots and thus did not affect each other. Therefore I did not think in this direction at all. But I give it a try. Thanks a lot.

                    I would like to reiterate that, as a proof of concept and by way of exercise, this is all very well. But a proper sleep functionality should be either implemented in the OS somewhere, as a global feature (maybe in settings?), or in the Music app itself as a local feature.

                    I understand your concerns. Neverteheless I would like to offer my app in the OpenStore, because some members here in the forum (including me) wish this app. The maintainers of UT and MediaPlayer did not respond to this request.

                    klhK 1 Reply Last reply Reply Quote 0
                    • klhK Offline
                      klh @digi6622
                      last edited by

                      @digi6622 I don't see any feature requests about what you describe here: https://gitlab.com/ubports/development/core/mediaplayer-app/-/issues
                      Where was the request made if nobody responded to it?

                      D 1 Reply Last reply Reply Quote 0
                      • D Offline
                        digi6622 @klh
                        last edited by

                        @klh said in Python should reset PulseAudio:

                        @digi6622 I don't see any feature requests about what you describe here: https://gitlab.com/ubports/development/core/mediaplayer-app/-/issues
                        Where was the request made if nobody responded to it?

                        You can find requests here:

                        https://open-store.io/app/com.ubuntu.music
                        https://forums.ubports.com/topic/4879/flas-sleep-timer

                        arubislanderA 1 Reply Last reply Reply Quote 0
                        • D Offline
                          digi6622
                          last edited by

                          Just a few basic thoughts from me:
                          Many mobile OS have disappeared because there simply wasn't much choice in apps. UT also doesn't have a wide distribution because there aren't many apps available. My wife would never switch from Android to UT for this reason. She simply lacks the little "helpers".
                          Therefore, it is important that every app, no matter how small, should be gratefully accepted. Every developer should be encouraged to continue to work for the community in his spare time (thanks to arubislander). His intentions should not be questioned. It doesn't have to be the huge "you-can-do-anything" app. Even the smallest app strengthens the OS. That's the only way UT can become something big.

                          AppLeeA 1 Reply Last reply Reply Quote 1
                          • arubislanderA Offline
                            arubislander @digi6622
                            last edited by

                            @digi6622 said in Python should reset PulseAudio:

                            You can find requests here:
                            https://open-store.io/app/com.ubuntu.music

                            The app ratings section is not the best place to make requests.

                            There is already a feature request here, and a merge request here. Please upvote the issue to signal interest. The MR is still a WIP by the way, maybe offer to help bring it to a state where it could be merged into the app?

                            πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
                            Happily running Ubuntu Touch
                            Google Pixel 3a (20.04 DEV)
                            JingPad (24.04 preview)
                            Meizu Pro 5 (16.04 DEV)

                            klhK 1 Reply Last reply Reply Quote 0
                            • AppLeeA Online
                              AppLee @digi6622
                              last edited by

                              @digi6622
                              You're absolutely right, contribution to the apps ecosystem is very important and every contribution is appreciated.
                              I wanted also to thank you for taking the time and effort to come here to ask about how to develop this feature and be patient about how it works.

                              I know some people are just searching for a hacky-hack way to get it done and if frustrated then will simply drop the idea.
                              And that's also important for us to be able to take the time to put you in the right direction like @arubislander did (thanks for that).

                              Ubuntu-Touch is not the typical Linux distro, it is a mobile OS with its constraints so the users can have the best OS possible.

                              1 Reply Last reply Reply Quote 0
                              • klhK Offline
                                klh @arubislander
                                last edited by

                                @arubislander what is actually needed here, is a way to tell media-hub to stop playback after some time - doing this on the app side is not a good solution, since it requires either keeping the screen on, or not suspending the app, both consuming resources/battery.

                                With the fix in media-hub other apps could use it as well (Podphoenix is a good example).

                                arubislanderA D 2 Replies Last reply Reply Quote 0
                                • arubislanderA Offline
                                  arubislander @klh
                                  last edited by

                                  @klh that might be a good comment to add to the MR.

                                  πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
                                  Happily running Ubuntu Touch
                                  Google Pixel 3a (20.04 DEV)
                                  JingPad (24.04 preview)
                                  Meizu Pro 5 (16.04 DEV)

                                  klhK 1 Reply Last reply Reply Quote 0
                                  • D Offline
                                    digi6622 @klh
                                    last edited by

                                    @klh Yes, you are right.
                                    Testing on my app revealed that the screen must kept on to activate the sleep timer. This is unacceptable.

                                    But the WIP of Music Player / Sleep timer shows no activity since 2 years and the trial version with the fix is outdated.

                                    1 Reply Last reply Reply Quote 0
                                    • klhK Offline
                                      klh @arubislander
                                      last edited by klh

                                      @arubislander Brian already did, I wrote it here for reference since the review on the MR is rather long. I can take a look at doing it once I finish higher priority stuff, I've been really missing this option in Podphoenix 😜

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