Firefox sound via crontab launch

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
msknight

Firefox sound via crontab launch

Post by msknight »

20.1 Cinnamon 4.8.6

I'm launching Firefox by crontab ... (reason, once a week perform updates and restart Firefox) ... however, there's no sound.

0 4 * * 1 pkill firefox
5 4 * * 1 export DISPLAY=:0 && firefox

...works, and with the right options in firefox, it just picks up where it left off. However... it won't play audio. The default output for sound is OK, but nothing comes out, until I quit firefox and restart by using the icons. Changing default audio destination and refreshing the page doesn't work either.

I'm guessing that there needs to be an equivalent export for the sound, as there is for the display, but I'm at a loss and need help please.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Firefox sound via crontab launch

Post by MrEen »

Hi msknight,

See if changing your first line to this helps:

Code: Select all

0 4 * * 1 pkill firefox && pulseaudio -k
That will restart the sound daemon, but may introduce unwanted results. For example, any currently playing audio will stop.
msknight

Re: Firefox sound via crontab launch

Post by msknight »

Hi MrEen,

Good suggestion, but sadly it didn't work.
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Firefox sound via crontab launch

Post by MrEen »

Okay, undo that change obviously.

Your "firefox" command just launches Firefox, and isn't an alias to firejail, correct? If you don't know what I'm talking about, that means the correct answer would be, "Correct."

The next time Firefox is started and doesn't work, run this in the terminal and paste the output:

Code: Select all

curl https://gitlab.freedesktop.org/pulseaudio/pulseaudio/raw/master/src/utils/pa-info?inline=false | bash | nc termbin.com 9999
Maybe I'll spot something in the link it gives that will provide a clue.
msknight

Re: Firefox sound via crontab launch

Post by msknight »

Here you go - https://termbin.com/z5q0

Interestingly the default sink is the podcaster mic, but I did plug some headphones in and nothing's coming out of the monitor there.

However, worth changing the default sink I presume... but I'll hang off doing anything until you've had a look.
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Firefox sound via crontab launch

Post by MrEen »

Yeah, that default sink is certainly the issue here. I assume you want the HDMI output as default, which this will quickly set:

Code: Select all

pacmd set-default-sink alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1
We may need to add a similar line to /etc/pulse/default.pa if this keeps happening.
msknight

Re: Firefox sound via crontab launch

Post by msknight »

Sadly, didn't work.

The default sink I would like to set is the digital output on the built in card, so I'm presuming that's alsa_output.pci-0000_00_1f.3.iec958-stereo

But that didn't work either. Still silent when started via crontab.
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Firefox sound via crontab launch

Post by MrEen »

I rarely see Digital as the default, and as the HDMI was available had assumed that was the one you wanted.

You did try the correct one after all, and by "didn't work" we need to clarify one thing. Setting the default this way does not move currently playing audio to the new device. Only newly started audio will start using the new default output. Was that tested?
msknight

Re: Firefox sound via crontab launch

Post by msknight »

The first test was that the setting was changed, firefox processes were pkilled and then crontab allowed to restart Firefox.

When that failed, I did re-do the test but reset pulseaudio after changing the setting again, just in case.

Knowing how to switch the default to the digital output actually helps another side issue I've got, so that's been a bonus. Is that set now, or do I need to update a config file please?

The overarching aim of this is to keep the main machine running, as it monitors e-mail, some game servers and server status on a few things, so I keep the box running 24/7 and only reboot for kernel updates... but the only thing that usually locks up the machine is when Firefox has leaked so much memory that I have to power off the machine and restart it... then reload everything. Hence trying to restart via Crontab.

Many thanks for your efforts on this.
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Firefox sound via crontab launch

Post by MrEen »

Just guessing here, but what if you set the RODE to input only, so it won't be available as an output:

Code: Select all

pacmd set-card-profile alsa_card.usb-RODE_Microphones_RODE_Podcaster_v2_7A48BB99-00 input:mono-fallback
msknight

Re: Firefox sound via crontab launch

Post by msknight »

That didn't work either, sadly.
Locked

Return to “Software & Applications”