somafm icon indicating copy to clipboard operation
somafm copied to clipboard

playback continues after quitting

Open czesiekhaker opened this issue 7 years ago • 1 comments

This has been annoying me for months now. I tried to fork and fix it but failed due to time constraints and not being that interested in JavaScript.

mpv is still running after stopping somafm (via ^C).

Steps to reproduce

$ somafm play defcon

  Playing   SomaFM DEF CON Radio

Pressing Ctrl+c at this point causes the program to output

  undefined  undefined

and the music keeps playing

$ ps a | grep mpv | grep -v grep
 7421 pts/8    Sl     0:01 mpv -quiet http://ice1.somafm.com/defcon-256-mp3

Workaround

$ killall mpv

This isn't perfect when you have multiple instances of mpv running (eg. some clips paused waiting to be finished).

Version info

$ somafm --version      
2.1.2
$ mpv --version
mpv 0.23.0 (C) 2000-2016 mpv/MPlayer/mplayer2 projects
 built on UNKNOWN
ffmpeg library versions:
   libavutil       55.34.101
   libavcodec      57.64.101
   libavformat     57.56.101
   libswscale      4.2.100
   libavfilter     6.65.100
   libswresample   2.3.100
ffmpeg version: 3.2.5-1

czesiekhaker avatar Jul 21 '17 13:07 czesiekhaker

Hi @czesiekhaker,

Thanks for your report!

I can't reproduce this on my machine. Pressing ctrl+c or q or esc kills the MPlayer or mpv process as expected.

What OS and Node.js version are you using?

You could try the following steps and check if they change anything:

  1. Run $ mpv http://ice1.somafm.com/defcon-256-mp3 directly and press ctrl+c to see if the process exits.
  2. Install the latest version of Node.js.
  3. Install the latest version of mpv.
  4. Install MPlayer. It will be used by default when available.
  5. Use a different kill signal by adding a parameter to the kill() function call. The default is 'SIGTERM', maybe 'SIGINT' or 'SIGKILL' work better here (although SIGKILL is less friendly).

(I'll fix the undefined output in the next release.)

cuschk avatar Jul 23 '17 15:07 cuschk

Switched to execa and force-killing after a timeout. (17919760b0258300c18999d9c64d6fd6aa101a5c)

This should solve the issue.

cuschk avatar Oct 20 '22 19:10 cuschk