Using Music Player Widget

Hi Guys,

I’ve looked at the player sketch you have but can’t figure out how I can use it to play an mp3 that’s in my raspberry pi downloads folder…

Can you explain what I need to do and how I to implement the sketch on the raspberry pi. I understand and can use Blynk for lights and dht22 with virtual pins but I don’t understand what I need to do to get Blynk to execute something on the Pi if you get me…

Probably the easiest question you’ll get all day ha :slight_smile:

Cheers, Tom

Don’t forget the search function in this forum :stuck_out_tongue_winking_eye:

This prior answer might help understand… it is basically a 4-in-1 button that responds with one of four strings - ‘stop, play, prev, next’, nothing more.

I use NodeJS on the RPi so this code might help you get started… but I have not yet bothered to actually make the RPi play any music… that can probably be Googled and then you could run that music code with this control code below.

Note: if you use WiringPi then just use a similar if-then process, but in C++

var PlayerWidget = new blynk.VirtualPin(0);  // Setup Player Widget on V0
var PlayerDisplay = new blynk.VirtualPin(1);  // Setup Display Widget on V1

// Player Widget
PlayerWidget.on('write', function(param) {  // Watches for PlayerWidget
    PlayerDisplay.write(param);  // Shows Player Widget output on Display Widget
      if (param == 'stop') {  // If PlayerWidget 'stop'
        // Do something to STOP music/video/etc.
      } else if (param == 'play') {  // If PlayerWidget 'play'
        // Do something to PLAY music/video/etc.
      } else if (param == 'prev') {  // If PlayerWidget 'play'
        // Do something to skip BACKWARD to music/video.etc.
      } else if (param == 'next') {  // If PlayerWidget 'play'
        // Do something to skip FORWARD to music/video/etc.

yeah, the name "music player’ is a bit misleading… it is just a widget with 3 buttons, thats all. it has nothing to do with actually playing music. ie, not more, than 3 standard “button” widgets :slight_smile:


At least the documentation tries to clarify it

Simple UI element with 3 buttons - simulates music player interface