Skip to content

Playing sound while running as systemd  #20

@thetoeb

Description

@thetoeb

I figured out that starting the mpg123 while being an systemd service don't work (also amixer and i think aplay also), because you need to specify the device you want to use. I workaround it by adding the package "Microsoft.Extensions.Hosting.Systemd" and if OS is Linux it checks with SystemdHelpers.IsSystemdService() to instantiate a different _internalPlayer, which uses the commands -a hw1,0 (for example) on mpg123 and -c 2 on amixer to ensure the correct device is used (Im currently using it on my Rasperry PI 4 B so this is the headphone output).

Maybe you could add that? I didn't figured out a good way to generically implement that to specify the correct device in that case, because i just needed that quick fix for my project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions