olavfosse / eradio

The simple radio player for GNU Emacs
GNU General Public License v3.0
62 stars 6 forks source link

eradio-play doesn't play radio #8

Closed j-steinbach closed 4 years ago

j-steinbach commented 4 years ago

Describe the bug

I call eradio-play and nothing happens.

To Reproduce

Configure (Doom) Emacs based on the readme:

    (map! :leader
          (:prefix ("r" . "eradio")
           :desc "Play a radio channel" "p" #'eradio-play
            :desc "Stop the radio player" "s" #'eradio-stop))

    (setq eradio-channels '(("def con - soma fm" . "https://somafm.com/defcon256.pls")          ;; electronica with defcon-speaker bumpers
                            ("metal - soma fm"   . "https://somafm.com/metal130.pls")           ;; \m/
                            ("cyberia - lainon"  . "https://lainon.life/radio/cyberia.ogg.m3u") ;; cyberpunk-esque electronica
                            ("cafe - lainon"     . "https://lainon.life/radio/cafe.ogg.m3u")))  ;; boring ambient, but with lain

Call SPC-r-p, select a channel. Nothing happens

Expected behavior

I expect a radio stream to play.

The value of eradio-player is the default one: ("vlc" "--no-video" "-I" "rc"). Calling that command in the terminal plays the radio as expected

    $ vlc --no-video -I rc https://somafm.com/defcon256.pls
    VLC media player 3.0.9.2 Vetinari (revision 3.0.9.2-0-gd4c1aefe4d)
    [0000562a1175a150] [cli] lua interface: Listening on host "*console".
    VLC media player 3.0.9.2 Vetinari
    Command Line Interface initialized. Type `help' for help.

Operating Systems

Linux 5.4.0-48-generic Ubuntu 20.04

VLC

$vlc --version
VLC media player 3.0.9.2 Vetinari (revision 3.0.9.2-0-gd4c1aefe4d)
VLC version 3.0.9.2 Vetinari (3.0.9.2-0-gd4c1aefe4d)
Compiled by buildd on lgw01-amd64-060.buildd (Apr  9 2020 19:29:44)
Compiler: gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)
$ which vlc
/usr/bin/vlc

Emacs


GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.10)
 of 2020-08-26
olavfosse commented 4 years ago

My first guess is that vlc is not in $PATH. Can you share your exec-path?

edit: It should say exec-path both places, $PATH and exec-path can be different.

j-steinbach commented 4 years ago

I am not sure what you mean..

The one that shows when I do echo $PATH?

/home/jst/.zplug/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Or the one in Emacs exec-path? ("/home/jst/.zplug/bin" "/usr/local/sbin" "/usr/local/bin" "/usr/sbin" "/usr/bin" "/sbin" "/bin" "/usr/games" "/usr/local/games" "/snap/bin" "/snap/emacs/current/usr/libexec/emacs/27.1/x86_64-pc-linux-gnu")

Or something else?

olavfosse commented 4 years ago

I was thinking of exec-path. I suspected that /usr/bin/vlc was not in your path, but that is evidently not the case as /usr/bin is present in exec-path.

So far I have not been able to reproduce your issue on my Mac. I tried using the default configuration, but had no issues.

Perhaps your Emacs is muted. Can you play play audio in other ways? Try running vlc --no-video -I rc https://somafm.com/defcon256.pls in M-x eshell or evaluating the following snippet.

(apply #'start-process 
  `("eradio-process" nil ,@eradio-player ,"https://somafm.com/defcon256.pls"))

If the issue persists I will try reproducing it on my Ubuntu box. In which case, please provide a minimal reproducible example.


$ uname -a
Darwin Yui 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
$ vlc --version
VLC media player 3.0.11.1 Vetinari (revision 3.0.11.1-0-g52483f3ca2)
VLC versjon 3.0.11.1 Vetinari (3.0.11.1-0-g52483f3ca2)
Bygd av d-fu den d-fus-Mac.local (Jul 27 2020 20:06:44)
Kompilert av: clang: warning: argument unused during compilation: '-mmacosx-version-min=10.7' [-Wunused-command-line-argument]
Dette programmet kommer UTEN GARANTIER, i den grad dette er tillatt ved lov.
Du kan distribuere det i henhold til vilkårene i GNU General Public License;
se filen COPYING for mer informasjon om dette.
Programmet er skrevet av VideoLAN-gruppen; se AUTHORS-filen.
$ emacs --version
GNU Emacs 27.1
Copyright (C) 2020 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
j-steinbach commented 4 years ago

I ran vlc --no-video -I rc https://somafm.com/defcon256.pls on "M-x shell"

VLC media player 3.0.9.2 Vetinari (revision 3.0.9.2-0-gd4c1aefe4d)
[000055ead11cde30] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
[000055ead11f54a0] [cli] lua interface: Listening on host "*console".
VLC media player 3.0.9.2 Vetinari
Command Line Interface initialized. Type `help' for help.
> [00007fe42803f280] prefetch stream error: unimplemented query (264) in control
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
[000055ead11cde30] alsa audio output error: cannot open ALSA device "default": No such file or directory
[000055ead11cde30] main audio output error: Audio output failed
[000055ead11cde30] main audio output error: The audio device "default" could not be used:
No such file or directory.
[000055ead11cde30] main audio output error: module not functional
[00007fe4282e39b0] main decoder error: failed to create audio output

and on "M-x eshell"

~ $ vlc --no-video -I rc https://somafm.com/defcon256.pls
VLC media player 3.0.9.2 Vetinari (revision 3.0.9.2-0-gd4c1aefe4d)
[000055ccda62d7d0] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
[000055ccda64f590] [cli] lua interface: Listening on host "*console".
VLC media player 3.0.9.2 Vetinari
Command Line Interface initialized. Type `help' for help.
> [00007f645803f280] prefetch stream error: unimplemented query (264) in control
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
[000055ccda62d7d0] alsa audio output error: cannot open ALSA device "default": No such file or directory
[000055ccda62d7d0] main audio output error: Audio output failed
[000055ccda62d7d0] main audio output error: The audio device "default" could not be used:
No such file or directory.
[000055ccda62d7d0] main audio output error: module not functional
[00007f64582de9e0] main decoder error: failed to create audio output

This seems like useful information.

olavfosse commented 4 years ago

Interesting, now that we have uncoupled the issue from the the rest of eradio, researching the problem yourself is trivial. Make sure to post your findings.

You are using the snap package, right? I believe that is the cause of the issue. I know Snap uses a sandboxing security technique which is probably why vlc can't create an audio output. It is worth looking into what user your Emacs is running as too.

Some relevant links. https://core.docs.ubuntu.com/en/guides/intro/security https://core.docs.ubuntu.com/en/stacks/audio/pulseaudio/docs/access-from-other-snaps

olavfosse commented 4 years ago

I got some ugly output on my Ubuntu / snap emacs 27.1, but it played fine nonetheless. apt emacs worked fine too. Hmmm.

~ vlc --no-video -I rc https://somafm.com/defcon256.pls
VLC media player 3.0.9.2 Vetinari (revision 3.0.9.2-0-gd4c1aefe4d)
[000055e34dc5b6f0] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
[000055e34dc245a0] [cli] lua interface: Listening on host "*console".
VLC media player 3.0.9.2 Vetinari
Command Line Interface initialized. Type `help' for help.
> [00007fb738028300] prefetch stream error: unimplemented query (264) in control

$ uname -a
Linux Shiina 5.4.0-48-generic #52-Ubuntu SMP Thu Sep 10 10:58:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ vlc --version
VLC media player 3.0.9.2 Vetinari (revision 3.0.9.2-0-gd4c1aefe4d)
VLC version 3.0.9.2 Vetinari (3.0.9.2-0-gd4c1aefe4d)
Compiled by buildd on lgw01-amd64-060.buildd (Apr  9 2020 19:29:44)
Compiler: gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute it under the terms of the GNU General Public License;
see the file named COPYING for details.
Written by the VideoLAN team; see the AUTHORS file.
$ which emacs
/snap/bin/emacs
$ emacs --version
GNU Emacs 27.1
Copyright (C) 2020 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
olavfosse commented 4 years ago

Could you try reproducing the issue in a fresh Ubuntu installation?

j-steinbach commented 4 years ago

I tried to play the command in the regular shell (not in Emacs) today - it didn't work.

I re-ran it in Emacs, I got the errors from yesterday (PulseAudio)

I tried to fix the PulseAudio issue by reinstalling it (apt remove, install, ..)

Now Emacs won't start anymore.

As this is not the only issue with my system, I am going to reinstall it. I will be MIA for some time (days?). Sorry about the trouble. I will report back if that fixes it.


VLC is not installed from the Snap store, it should be from apt

olavfosse commented 4 years ago

That is unfortunate. I hope a reinstall fixes your issue.

j-steinbach commented 4 years ago

I solved it! The answer: The VLC player was muted... Yeah.


Maybe there is a way warn the user if the player is muted? Or a way to set a default volume that will always be applied.

PS: Happy on Manjaro i3... just cost me 2 days.. :)

olavfosse commented 4 years ago

Great, glad you solved it.

Maybe there is a way warn the user if the player is muted? Or a way to set a default volume that will always be applied.

This is outside the scope of eradio since as far as I know there is no remotely media player agnostic way to find out if they are muted.

Closing.