I would think the statuses have a meaning, but I was not able to find documentation for that. So I'm calling play()
for whatever status shows up
From what I tested through clickable desktop
I found that Loaded
indicates the player is ready to play, and apparently if the status is Loading
, it is not. But on the phone no other statuses occur, I tested repeatedly and in a couple of cases I waited for at least 10 minutes for other statuses to show up. No luck.
Latest posts made by janmv
-
RE: How to start an audio stream at application start?
-
RE: How to start an audio stream at application start?
Thanks for the suggestion, but no, that does not work either. The player status and playback state is 'Loading' & "paused" before
onCompleted
triggers, and calling play() then doesn't change that.
I tried also withQt.application.onStateChanged
, to see if the application needs to be active, but no difference. -
How to start an audio stream at application start?
I have made a small QML application with a MediaPlayer with a fixed URL stream source, which I want to start at application startup.
Usingclickabe desktop
the application works. The players status changes from 'Loading' to 'Loaded', and at this status change play() starts the player. My desktop is Ubuntu 20.04.
Usingclickable
the application does not work.clickable log
shows that the player status remains 'Loading', calling play() only puts the player in playback state 'paused'. My phone is a Fairphone 4, UT 20.04 OTA-7. The apparmor has"policy_groups": ["audio", "networking"],
.
For the code see below.
The button is to test for possible permission problems. But that is not the case, if clicked, the stream plays.
What also works is to start a timer (interval 3s) which callsaudioPlayer.play()
.
But that shouldn't be necessary, should it? What am I missing here?The code:
import QtQuick 2.7 import Lomiri.Components 1.3 import QtMultimedia 5.12 MainView { id: root Rectangle { anchors.fill: parent Button { id: manualPlay text: "Play" onClicked: { console.log("Clicked Play") audioPlayer.play() } } } MediaPlayer { id: audioPlayer audioRole: MediaPlayer.MusicRole source: "http://icecast.omroep.nl/radio4-eigentijdsfb-mp3" onStatusChanged: { console.log("onStatusChanged(): status = ", getPlayerStatus(status), " playbackState = ", getPlayerState(playbackState), " app state = ", getApplicationState(Qt.application.state)); if (audioPlayer.playbackState !== MediaPlayer.PlayingState) { console.log(" calling play()"); audioPlayer.play(); } } } function getPlayerStatus(playerStatusCode) { switch (playerStatusCode) { case MediaPlayer.NoMedia: return "NoMedia" case MediaPlayer.Loading: return "Loading" case MediaPlayer.Loaded: return "Loaded" case MediaPlayer.Buffering: return "Buffering" case MediaPlayer.Stalled: return "Stalled" case MediaPlayer.Buffered: return "Buffered" case MediaPlayer.EndOfMedia: return "End of media" case MediaPlayer.InvalidMedia: return "Invalid media" case MediaPlayer.UnknownStatus: return "Unknown status" default: return "unknown player status"; } } function getPlayerState(playerStateCode) { switch (playerStateCode) { case MediaPlayer.PlayingState: return "Playing" case MediaPlayer.StoppedState: return "Stopped" case MediaPlayer.PausedState: return "Paused" default: return "unknown player state"; } } function getApplicationState(applicationStateCode) { switch (applicationStateCode) { case Qt.ApplicationSuspended: return "Suspended" case Qt.ApplicationHidden: return "Hidden" case Qt.ApplicationInactive: return "Inactive" case Qt.ApplicationActive: return "Active" default: return "unknown application state"; } } }
-
Player for streaming audio not showing metadata
I installed Ubuntu Touch 20.04 (OTA-7) on a Fairphone 4, to renew my involvement in the open source community, and I started to explore UT to see in what way I could contribute - there is a lot to choose from.
As the radio alarm on my old Android phone was never really reliable, I looked for a UT alternative (which does not exist, does it?), and then at alarms and streaming radio.From the (focal) radio apps in the store, the Radio app (by patrickjane) is fine. Information on the music which playing is initially visible in a scrolling label, but after starting and stopping the player a couple of times, the label only says 'Playing'. Somehow, that became worse, so currently, I never get the music information anymore. So I did the following:
- I downloaded the source and stripped it down to the essentials, used 'clickable' to build and install it on the phone. The metadata never displays, because the onMetadataChanged signal handler is never triggered. On the desktop (Ubuntu 20.04, 'clickabe desktop'), it works as expected (in a Docker container).
- I checked other audio streaming apps for Focal, but none present metadata. From the old Xenial apps (found here), only flas presents metadata, but flas accesses the metadata property of QML Mediaplayer directly, not through a signaling mechanism.
- I have monitored the D-bus on the phone and I see that metadata is presented to the bus by media-hub. It also seems (I'm not sure) that the Radio app listens to the MediaHub Service session which is sending PropertiesChanged signals. These signals contain metadata including titles.
- I also checked apparmor log entries (using journalctl). There are about 15 apparmor="DENIED" entries for a single run of the app (opening, playin a station for some time, stopping the player, closing the app). Two originate from the dbus-daemon, for interface "com.lomiri.content.dbus.Service" and member "HandlerActive", I have no idea if that is related to this bug.
Remarkably, the sound indicator shows music titles on both devices. A 2021 post mentions the issue, with the sound indicator as a workaround. That may work for a user, but from a developer perspective that adds to the riddle.
So I also took a look at the sound indicator. If I understand correctly, audio players can register to the Ayatana sound indicator so that they are displayed in a very minimal way. I did not find any further information on how that works. I have been looking at the source of mediahub and the Ayatana sound indicator to find out, but I get lost.So I am curious as to what is going on here:
-
What difference between the FP4 and the Docker container on the desktop may cause the metadata signaling mechanism to work differently on both? How can I find out?
-
How do audio players, the sound indicator and the media-hub interact? Does the Radio app register to the sound indicator? And if it registers, why do music titles appear in the indicator, and not in the app itself? If it is a different player that registers to the indicator, which one is that? And how could this player take over the stream playing in the Radio app? Or has it always been there, as a kind of a pass-through player, which is shown by the sound indicator, but then fails to pass on the metadata?
-
RE: Can’t manage the bootloader to unlock
@Moem Thanks. I downgraded to Android 11 before running the UBports installer, and that was successful. It wasn't all first-time-right (see above, had to run fastboot as root), but it was easy enough to find and overcome the obstacles using this forum.
-
RE: Can’t manage the bootloader to unlock
@kevin-lhotellier I'm in the same situation (or similar).
With respect to the command "fastboot flashing unlock" and its response "waiting for any device", and then waiting indefinitely...: what worked for me is to run this command as root in Ubuntu. I tried this after reading a suggestion to run the command 'as Administrator' in Windows, on the Fairphone forum.
With repect to the instruction in UT for FP4: "Your device must be running the Fairphone OS version of Android 11 before installing another operating system. With a previously installed custom ROM, it won't work!", I wonder if a downgrade from Android 13 to 11 is at all necessary. Android 13 is hardly a custom ROM, isn't it?
Any help or experiences regarding this last question?
Thanks!