• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
RetroPie forum home
  • Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login

Streaming internet radio when browsing for games and on screensaver?

Scheduled Pinned Locked Moved Ideas and Development
internetradiostreamingmp3
47 Posts 7 Posters 8.4k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    mitu Global Moderator @jonnykesh
    last edited by 1 Oct 2017, 10:07

    @jonnykesh It's quite similar to the method in the topic I mentioned first, so it might have originated there.
    I used the vlc control-over-unix-socket method instead of the script because it gives more control over how the playlist should be played - you can jump to the next radio station in the playlist when going back to ES from a game.

    1 Reply Last reply Reply Quote 0
    • P
      pipesfranco
      last edited by 2 Oct 2017, 19:53

      This is awesome thank you so much for your help :)

      1 Reply Last reply Reply Quote 0
      • P
        pipesfranco
        last edited by 3 Oct 2017, 21:28

        One last thought guys...is there anyway to make the radio fade out rather than cut out once a game is selected and fade back in when you exit a game?

        No big issue but just a thought?

        Thanks again

        :)

        M 1 Reply Last reply 4 Oct 2017, 06:05 Reply Quote 0
        • M
          mitu Global Moderator @pipesfranco
          last edited by 4 Oct 2017, 06:05

          @pipesfranco I actually tried adding a cross-fade effect when stopping/resuming vlc, but it does not support that. Various searches on the interwebs show that it's not implemented in currently (see for instance this ticket).

          I'll see if we can find an alternative to VLC that supports both streaming from internet radio sources and fade out/in for audio.

          1 Reply Last reply Reply Quote 0
          • N
            NowArrivingHere @mitu
            last edited by NowArrivingHere 10 Apr 2017, 12:13 4 Oct 2017, 10:49

            @mitu

            Raspberry Pi 3B
            2.4A power supply
            Raspbian Stretch
            RetroPie 4.3.1

            I haven't been able to get this working properly. I suspect there is a problem with my particular setup. I have RetroPie installed on top of Raspbian Stretch, which I know has issues.

            Step 1 and 4 work fine for me. I was able to install everything, add my station (AI Radio), and get it to start playing automatically when emulationstation starts. However, step 2 and 3 are where everything falls apart.

            The step 2 runcommand-onstart.sh breaks my runcommand. The music keeps playing and my chosen emulator fails to launch. I tried copy-pasting. I tried typing by hand. I even looked at the other thread and used chmod to allow execution privileges for all. It didn't work. The files were newly created and no other commands were added.

            As for Step 3, my .bashrc doesn't have a retropie_welcome or #RETROPIE PROFILE END

            Again, it is clear some people have gotten this working, so it is probably down to my particular setup. I'm just not sure what I did wrong.

            M 1 Reply Last reply 4 Oct 2017, 16:08 Reply Quote 0
            • M
              mitu Global Moderator @NowArrivingHere
              last edited by 4 Oct 2017, 16:08

              @nowarrivinghere Can you paste here the contents of the /opt/retropie/configs/all/runcommand-onstart.sh file ? It seems this is the stuff that breaks for you.

              N 1 Reply Last reply 4 Oct 2017, 16:18 Reply Quote 0
              • N
                NowArrivingHere @mitu
                last edited by 4 Oct 2017, 16:18

                @mitu
                Sure. Here you go

                echo -n pause | nc -U /tmp/radio.sock >/dev/null 2>&1
                
                M 1 Reply Last reply 4 Oct 2017, 16:19 Reply Quote 0
                • M
                  mitu Global Moderator @NowArrivingHere
                  last edited by 4 Oct 2017, 16:19

                  @nowarrivinghere You might be missing the nc utility. Does the command works if you run it in a terminal ? Just type nc and see if you get any error.

                  N 1 Reply Last reply 4 Oct 2017, 16:22 Reply Quote 0
                  • N
                    NowArrivingHere @mitu
                    last edited by 4 Oct 2017, 16:22

                    @mitu

                    pi@raspberrypi:~ $ nc
                    usage: nc [-46CDdFhklNnrStUuvZz] [-I length] [-i interval] [-O length]
                              [-P proxy_username] [-p source_port] [-q seconds] [-s source]
                              [-T toskeyword] [-V rtable] [-w timeout] [-X proxy_protocol]
                              [-x proxy_address[:port]] [destination] [port]
                    
                    M 1 Reply Last reply 4 Oct 2017, 16:25 Reply Quote 0
                    • M
                      mitu Global Moderator @NowArrivingHere
                      last edited by mitu 10 Apr 2017, 17:25 4 Oct 2017, 16:25

                      @nowarrivinghere So netcat is installed. What happens if you run the command from the onstart file manually, after ES is started and the music plays ? It should pause the music.

                      echo -n pause | nc -U /tmp/radio.sock >/dev/null 2>&1
                      

                      Can you run the command from a SSH session and see what's the outcome ? If it works (i.e. music is paused), try starting a game and (after you get thrown back to ES ) then paste the contents of the /var/shm/runcommand.log file, we might have some clues there.

                      N 1 Reply Last reply 4 Oct 2017, 16:47 Reply Quote 0
                      • C
                        cyperghost @jonnykesh
                        last edited by cyperghost 10 Apr 2017, 17:44 4 Oct 2017, 16:44

                        @jonnykesh said in Streaming internet radio when browsing for games and on screensaver?:

                        I wish I could remember who wrote it so I could give them credit.

                        Not written completly just modified a bit... but I introduced here.... with correspondending source ;)

                        1 Reply Last reply Reply Quote 0
                        • N
                          NowArrivingHere @mitu
                          last edited by 4 Oct 2017, 16:47

                          @mitu

                          Okay, I just used SSH to try the pause command while the music was playing. I've waited about 90 seconds. Music is still playing and the SSH window is unresponsive.

                          M 1 Reply Last reply 4 Oct 2017, 17:02 Reply Quote 0
                          • M
                            mitu Global Moderator @NowArrivingHere
                            last edited by mitu 10 Apr 2017, 18:03 4 Oct 2017, 17:02

                            @nowarrivinghere Sorry, forgot about removing the redirection. Execute this:

                            ls -l /tmp/radio.sock
                            echo -n pause | nc -U /tmp/radio.sock

                            I suspect it might be a permission problem.

                            N 1 Reply Last reply 4 Oct 2017, 17:16 Reply Quote 0
                            • N
                              NowArrivingHere @mitu
                              last edited by NowArrivingHere 10 Apr 2017, 18:17 4 Oct 2017, 17:16

                              @mitu

                              Still fails to pause and leaves the window stuck.

                              pi@raspberrypi:~ $ ls -l /tmp/radio.sock
                              srwxr-xr-x 1 pi pi 0 Oct  4 16:42 /tmp/radio.sock
                              pi@raspberrypi:~ $ echo -n pause | nc -U /tmp/radio.sock
                              
                              M 1 Reply Last reply 4 Oct 2017, 17:40 Reply Quote 0
                              • M
                                mitu Global Moderator @NowArrivingHere
                                last edited by 4 Oct 2017, 17:40

                                @nowarrivinghere I have no idea why it does that - maybe Stretch has a different version of VLC that's not the same as the one I tested and the old interface doesn't work anymore ?

                                Just to check if there is a problem with newer versions, kill the VLC that is started via the autostart with killall vlc, then start the playback directly from thessh session, by running

                                vlc -I oldrc --rc-unix /tmp/radio.sock -Zq --no-video /home/pi/radio/list.txt
                                

                                You should get the radion playing this way with logging from VLC on the terminal.
                                Now, from a 2nd SSH session, run the echo command that's giving you trouble and see if it pauses the stream or any error appears in the 1st terminal, where VLC is running.

                                Other than that, maybe the output of /dev/shm/runcommand.log from starting a game might be of use.

                                N 1 Reply Last reply 5 Oct 2017, 02:08 Reply Quote 0
                                • N
                                  NowArrivingHere @mitu
                                  last edited by NowArrivingHere 10 May 2017, 04:46 5 Oct 2017, 02:08

                                  @mitu

                                  Okay, this is interesting, I opened SSH Window 1, killed vlc, and reopened it via the command you gave. Then, in SSH Window 2, I ran the pause command. It appeared to sit there with the music still playing just as before. However, I then did a CTRL+C in Window 2 and it paused. Then I used the pause command in Window 2 again. Once again, it just sat there silently. Then I did CTRL+C and sure enough it started playing music again. Also, here is the output that appeared in Window 1.

                                  status change: ( new input: http://listen.ai-radio.org:8000/128.ogg?cc=US&now=1507110308.444& )
                                  status change: ( play state: 3 )
                                  pause: returned 0 (no error)
                                  status change: ( pause state: 3 ): Pause
                                  status change: ( pause state: 4 )
                                  pause: returned 0 (no error)
                                  status change: ( play state: 2 ): Play
                                  status change: ( play state: 3 )
                                  pause: returned 0 (no error)
                                  status change: ( pause state: 3 ): Pause
                                  status change: ( play state: 3 )
                                  pause: returned 0 (no error)
                                  

                                  EDIT: I decided to just place the script that jonnykesh brought us inside my runcommand-onstart.sh and runcommand-onend.sh with the mpg123 replaced with vlc. That seems to work and perform the function of the pause command on the cases I have tried so far. Its probably not as efficient as the actual vlc controls, but I haven't noticed a delay from a human perspective. It is more efficient than just using the kill all command and then that command we added in autostart.sh and restarting vlc every time though, which was my backup plan and did introduce a delay. Would be nice to have access to the other vlc controls, but I can't think of anything else to try right now.

                                  M 1 Reply Last reply 5 Oct 2017, 04:29 Reply Quote 0
                                  • M
                                    mitu Global Moderator @NowArrivingHere
                                    last edited by 5 Oct 2017, 04:29

                                    @nowarrivinghere This means the netcat commands you run in the 2nd window reads the pause command but it doesn't send it right away and awaits further input.
                                    I'll do some testing with the version in Stretch to see if it behaves differently than the one in the Jessie release, but glad you got it working with the alternate start/stop command.

                                    1 Reply Last reply Reply Quote 0
                                    • M
                                      mitu Global Moderator
                                      last edited by 5 Oct 2017, 06:31

                                      Ok, found out the difference - tested on a Stretch system. The netcat command doesn't return and still waits for input from the tty. To force it to close the input, using -N seems to do the trick.
                                      @NowArrivingHere you can try changing the on-start/on-end commands to

                                      echo -n pause | nc -UN /tmp/radio.sock
                                      

                                      Unfortunately the -N option doesn't exist in the Jessie version of netcat-openbsd, I'll see if we can ditch netcat completely and use something else.

                                      1 Reply Last reply Reply Quote 0
                                      • M
                                        mitu Global Moderator
                                        last edited by 5 Oct 2017, 16:09

                                        OK, I've found a way to ditch netcat - by replacing it with socat. I have updated the instructions steps with the new commands (steps 2 and 3, plus the pre-requisites).
                                        This should work on both Jessie and Stretch - and possibly other systems.

                                        N 1 Reply Last reply 6 Oct 2017, 18:35 Reply Quote 0
                                        • N
                                          NowArrivingHere @mitu
                                          last edited by 6 Oct 2017, 18:35

                                          @mitu
                                          Thanks mate. It is pausing and playing properly now.

                                          1 Reply Last reply Reply Quote 0
                                          31 out of 47
                                          • First post
                                            31/47
                                            Last post

                                          Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                          Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.

                                            This community forum collects and processes your personal information.
                                            consent.not_received