Python should reset PulseAudio
-
@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.
-
@digi6622 I ask because for what you want to do, you probably o ly need QML and some Javascript.
-
@arubislander
QML and Javascript are okay. -
@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.
-
@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.
-
@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? -
@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 -
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. -
@digi6622 said in Python should reset PulseAudio:
You can find requests here:
https://open-store.io/app/com.ubuntu.musicThe 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?
-
@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.
-
@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).
-
@klh that might be a good comment to add to the MR.
-
@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.
-
@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