Read the statement by Michael Teeuw here.
MMM-MP3Player (remade asimhsidd's player)
-
i cant get notifications to start the player. Can you add an example? Thanks. How to use it with
MMM-Remote-Control. -
@jonae looks like from the code, it can play music that is defined in the config.
case "PLAY_MUSIC": if (audioElement.paused){ audioElement.play(); } else { self.sendSocketNotification("LOADFILE", self.songs[self.current]); } break; case "STOP_MUSIC": audioElement.pause(); break; case "NEXT_TRACK": if(!self.musicFound){ self.album_art.classList.toggle('active'); return; } if (self.config.random){ if (!arrPlayed.includes(false)){ arrPlayed.fill(false); } do { ind = Math.floor(Math.random() * self.songs.length); // (self.current + 1) % self.songs.length; } while (arrPlayed[ind] || ind == self.current); // ind == self.current: not to play one song twice - in the end of list and in the beginning of newly created list) arrPlayed[ind] = true; self.current = ind; } else { if(self.current==(self.songs.length-1)){ // this assures the loop self.current = -1; } self.current++; } self.sendSocketNotification("LOADFILE", self.songs[self.current]); break; case "PREVIOUS_TRACK": if(self.current==0){ // this assures the loop self.current = (self.songs.length); } self.current--; self.sendSocketNotification("LOADFILE", self.songs[self.current]); break; case "RANDOM_ON": self.config.random = true; break; case "RANDOM_OFF": self.config.random = false; break;
-
@sdetweil i saw that, i send the notification and nothing happens…
-
@jonae do you have the music defined in config?
u can use the developers window, sources tab to walk thru the modules code
ctrl-shift-i, select the sources tab, find the module and its js file, will show to the right
click the line number in the left edge where the notificationReceived is
then send your notification and it shoudl stop there, then the circle arrow, is step instruction
and u can hover over the variables to see what they containblue arrow to run to next stop (if any)
-
@sdetweil thanks for the tipp, but nothing happens. like it is ignoring the notification, maybe remote control is not sending the right notification…
-
@jonae notification is a text string
notification is just a text string, here its ‘PLAY_MUSIC’
u have to configure that as remote doesn’t have it built in.
-
@sdetweil i have done it with curl, but now I am searching a easier way to play and stop music using curl
-
@jonae ok, can’t help with remote and I don’t use that module
-
@sdetweil thanks anyways!!
-
@Jonae hi did you ever manage to control another way?