MagicMirror² v2.8.0 is available! For more information about this release, check out this topic.

Help with Pages...


  • Module Developer

    anyone have an idea of how to disable, or stop, or pause, etc a module when the page changes away from the page the module is on?

    IE: I have 3 pages, on one of the pages, I have a module that plays music either by audio or video, currently, that module will continue playing no matter what page I go to. if the video player module is on page 3, then it should not be heard if on pages 1 & 2.
    Or if I have the Spotify module on page 1, then it shouldn’t be heard on pages 2 & 3.
    etc

    Any Ideas from anyone?
    I have tried a few searches without success

    Thanks in advance!



  • @justjim1220 I think u will need to add code to handle the hide/show.

    I think if I remember correctly, there is a player setting for allowing background play(or not)



  • I think the Spotify module just shows what is playing elsewhere, not on the mirror itself


  • Module Developer

    @sdetweil that’s what I am having the problem with. I use MMM-pages, it doesn’t really use a css file except to give the module position. so I have no idea how to set it up this way.

    Here’s another example:
    On page 1 I have MMM-Spotify
    Page 2 I have MMM-SoundMachine
    And page 3 I have MMM-MyVideoPlayer

    I would have the page swap set to say 3 hours, meaning it will change to the next page after 3 hours, So, if on page 1, MMM-Spotify is active and playing, then the modules on pages 2 & 3 are inactive (not playing). And, when the 3 hours is up and the page changes to page 2, then Spotify would become inactive, SoundMachine would become active, and the video player would remain inactive until the page changes to page 3.

    I hope this makes sense, I am not sure where in the configurations of the modules or in custom css or what to place code to make this happen, NOR, do I have any idea how to write the code for something like this.



  • @justjim1220 each module would have to handle the hide(suspend)/show(resume) effect on themselves. Pages uses hide/show which turns into the suspend/resume calls


  • Module Developer

    @sdetweil

    looking through dev tools on this, I see when a page turns, whether by click or by timer, it will list all the modules from the current page and suspend them, then it lists all the modules for the second page and resumes them. And it looks as if it is done via notification.

    Is it possible to use the dev tools notification as a trigger to show/hide, suspend/resume, or disable/enable?

    @sdetweil said in Help with Pages...:

    @justjim1220 each module would have to handle the hide(suspend)/show(resume) effect on themselves. Pages uses hide/show which turns into the suspend/resume calls

    so, what I am getting from this statement, this can be done through the pages module???



  • @justjim1220 no… each module has to add code to deal with it…

    like your video player… add a suspend() routine to be called when hidden and a config option for backgroundPlay true/false

    and if playing on suspend, and you’re supposed to stop, then stop playing…
    and if resumed and were playing then resume playing, (if u can)…

    but other modules will have to add code like that too… you cannot MAKE them behave