OpenVoiceOS / ovos-ocp-audio-plugin

Apache License 2.0
4 stars 6 forks source link

All media play requests loop (silently) until ovos restart #84

Closed ShuffleBit closed 1 year ago

ShuffleBit commented 1 year ago

Any attempt to play media (local media, news, etc) starts a neverending loop of attempts to play the media. No errors, no playing of the media, and continues until ovos is restarted.

raspbian-ovos-dev, rpi4b, no TV, ovos-plugin-common-play==0.0.6a1

May 26 06:16:44 raspOvos ovos-systemd-audio[810]: 2023-05-26 06:16:44.250 - audio - ovos_plugin_common_play.ocp.media:extract_stream:461 - INFO - OCP plugins metadata: {'uri': 'https://freemusicarchive.org/track/JoshWoodward-TSL-NoVox-102-Go/stream/'} May 26 06:16:48 raspOvos ovos-systemd-audio[810]: 2023-05-26 06:16:48.196 - audio - ovos_utils.file_utils:resolve_resource_file:145 - WARNING - Expected a dict config and got None. This configfallback behavior will be deprecated in a future release May 26 06:16:48 raspOvos ovos-systemd-audio[810]: 2023-05-26 06:16:48.244 - audio - ovos_utils.file_utils:resolve_resource_file:145 - WARNING - Expected a dict config and got None. This configfallback behavior will be deprecated in a future release May 26 06:16:48 raspOvos ovos-systemd-audio[810]: 2023-05-26 06:16:48.381 - audio - ovos_plugin_common_play.ocp.media:handle_track_state_change:512 - INFO - TrackState changed: <TrackState.PLAYING_AUDIOSERVICE: 21> May 26 06:16:48 raspOvos ovos-systemd-audio[810]: 2023-05-26 06:16:48.437 - audio - ovos_plugin_common_play.ocp.media:handle_track_state_change:512 - INFO - TrackState changed: <TrackState.QUEUED_AUDIOSERVICE: 31> May 26 06:16:48 raspOvos ovos-systemd-audio[810]: 2023-05-26 06:16:48.656 - audio - ovos_plugin_common_play.ocp.media:extract_stream:461 - INFO - OCP plugins metadata: {'uri': 'https://freemusicarchive.org/track/JoshWoodward-TSL-NoVox-102-Go/stream/'} May 26 06:16:52 raspOvos ovos-systemd-audio[810]: 2023-05-26 06:16:52.694 - audio - ovos_utils.file_utils:resolve_resource_file:145 - WARNING - Expected a dict config and got None. This configfallback behavior will be deprecated in a future release May 26 06:16:52 raspOvos ovos-systemd-audio[810]: 2023-05-26 06:16:52.729 - audio - ovos_utils.file_utils:resolve_resource_file:145 - WARNING - Expected a dict config and got None. This configfallback behavior will be deprecated in a future release May 26 06:16:52 raspOvos ovos-systemd-audio[810]: 2023-05-26 06:16:52.895 - audio - ovos_plugin_common_play.ocp.media:handle_track_state_change:512 - INFO - TrackState changed: <TrackState.PLAYING_AUDIOSERVICE: 21>

Audio config is default and doesn't paste into a code block well.

JarbasAl commented 1 year ago

what platform is this in? do you have any actual audio playback plugins installed?

eg, https://github.com/OpenVoiceOS/ovos-vlc-plugin or https://github.com/OpenVoiceOS/ovos-audio-plugin-simple ?

ShuffleBit commented 1 year ago

This is the raspbian-ovos-dev image running headless, so defaults: ovos_common_play, ovos_audio_simple, and ovos_vlc. Default "Audio" config, so all are active, and ovos_common_play is default.

ovos-plugin-common-play==0.0.6a1 ovos-audio-plugin-simple-0.0.2a3 ovos-plugin-vlc-0.0.2a2

Interesting thing, you asked about them so I upgraded ovos-audio-plugin-simple and ovos-plugin-vlc and the problem evolved: now I get:

07:08:49.074 - audio - ovos_plugin_common_play.ocp.player:_get_preferred_audio_backend:375 - ERROR - Preferred audio service backend not installed

And it's looping, but this is an improvement. What preferred backend is it expecting?

Edit: it looks like OCP and vlc expect dbus. I expected the vlc thing but it's a fallback. That implies either an xorg server or a whole lot of customizing to get dbus to run w/o X11. Can I simply configure OCP and vlc for Active: false? Will the simple plugin pick up any slack?

I don't want a TV on my PA, eating resources and electricity for a clock and weather widget. I don't want my PA to be visible at all, yet omnipresent, as if speaking from Olympus, or the bathroom. A display is fine, optionally.

So, it seems the real problem is that OCP doesn't report that it's headless and fallback to an internal or externally configured headless audio behavior. Instead, it loops, silently failing forever or until a system restart.

Edit 2: No, the simple plugin alone doesn't work at all, or its default configuration doesn't allow it to work. Any skill that would need to stream - even local mp3 - fails over to the fallback skill. Yike.

ShuffleBit commented 1 year ago

I don't see a clean path around this. If ocp recognizes that there's no dbus available, it can fork/exec a cmus process and use pycmus' api to control playback via cmus' default unix socket with messages from ovos' message bus. That does nothing for streaming internet audio.

It's solvable, but not in a clean robust way.

I'm going to close this.

JarbasAl commented 1 year ago

OCP should work headlessly, while we focused on the GUI to allow video playback it should work headlessly and started as fully headless project

We focused on the GUI aspect as we wanted an alternative for the mk2 as soon as it came out, so we were ready for it, but a fully headless reference image is something we just now started focusing on, with raspbian-ovos being the initial community effort to get that going as a replacement for picroft

the buildroot image will have a headless rpi3 compatible image version soon, the voice only experience will improve a lot once we get there and include a full headless system in our tests, that should then uncover these issues that happen only under certain configs and package combinations. currently most components are only tested individually (with a lot of room for improvement)

now some clarifications about OCP itself, or at least what should be happening:

EDIT:

add 'disable_mpris': true under OCP config if you don't want it to load at all

ShuffleBit commented 1 year ago

OCP should work headlessly

Yes, I looked through the code. It doesn't, currently. I couldn't find out why it loops forever but I didn't look very hard.

I'm already leaning toward ovos over all other options at this point. It's elegant.

I'm going to look at the cmus plugin. Thanks for the links.

I'm leaving this closed because otherwise, I should request a pull, and then I'd have to fix the looping, and then I'd be pulled in for eternity and a bit.

tarikki commented 1 year ago

I ran into the exact same issue with the following setup:

What solved it was the 'disable_mpris': true. I'll make a small PR and add this to the documentation regarding troubleshooting audio here.