MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-MP3Player (remade asimhsidd's player)

    Scheduled Pinned Locked Moved Entertainment
    mp3 playermusic player
    14 Posts 5 Posters 4.5k Views 5 Watching
    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.
    • X Offline
      x3mEr
      last edited by

      UPD:

      Version 1.2.0 - 2020.09.14

      • Now player displays album cover. It tries to retrieve the image from ID3-Tags, if nothing found, it searches file cover.jpg in the playing music file directory.
      • add: turn random on/off over notifications.
        more in README.md
      1 Reply Last reply Reply Quote 0
      • J Offline
        Jonae
        last edited by Jonae

        i cant get notifications to start the player. Can you add an example? Thanks. How to use it with
        MMM-Remote-Control.

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @Jonae
          last edited by

          @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;
          

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            Jonae @sdetweil
            last edited by

            @sdetweil i saw that, i send the notification and nothing happens…

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @Jonae
              last edited by

              @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 contain

              blue arrow to run to next stop (if any)

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              J 1 Reply Last reply Reply Quote 0
              • J Offline
                Jonae @sdetweil
                last edited by

                @sdetweil thanks for the tipp, but nothing happens. like it is ignoring the notification, maybe remote control is not sending the right notification…

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @Jonae
                  last edited by

                  @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.

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  J 1 Reply Last reply Reply Quote 0
                  • J Offline
                    Jonae @sdetweil
                    last edited by

                    @sdetweil i have done it with curl, but now I am searching a easier way to play and stop music using curl

                    S B 2 Replies Last reply Reply Quote 0
                    • S Offline
                      sdetweil @Jonae
                      last edited by

                      @jonae ok, can’t help with remote and I don’t use that module

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      J 1 Reply Last reply Reply Quote 0
                      • J Offline
                        Jonae @sdetweil
                        last edited by

                        @sdetweil thanks anyways!!

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy