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.

    Scheduling a YouTube video to start/stop via MMM-Remote-Control

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    4 Posts 2 Posters 747 Views 2 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.
    • M Offline
      madebyelmcity
      last edited by madebyelmcity

      Looking for some guidance. I’m using MMM-ModuleScheduler and MMM-Remote-Control to turn my monitor on/off, and to hide certain modules depending on the time of day. Works great.

      But, I have a YouTube video (white noise) that I’d like to start in the evening, and have stop in the AM.

      Playing the video is no problem — I’m using MMM-EmbedYoutube) as below:

      module: "MMM-EmbedYoutube", 
                      position: "middle_center",        
                      config: {
                              video_id: "nDqP7kcr-sc",
                              loop: true,
                              autoplay:true,
                              controls:false,
                              }
                      },
      
      

      I tried to hide/show the video via MMM-Remote-Control/MMM-Module-Scheduler, but couldn’t figure out why the sound kept playing. Of course, it’s because hiding/showing doesn’t turn it off/on.

      So I’m trying to find solution, but am stuck here as modifying the config.js file is about the limit of my technical knowledge.

      Looking at the page for MMM-YouTube I can see that I can use YouTube’s iFrame API methods to control its player. And this is what I’d want to do:

      this.sendNotification("YOUTUBE_CONTROL", {
        command: "playVideo"
      })
      

      I’m just not sure how/where to create that notification. Ideally I can use the modules above to playVideo or pauseVideo, at certain times of the day.

      Any guidance you can provide would be super helpful!

      ? 2 Replies Last reply Reply Quote 0
      • ? Offline
        A Former User @madebyelmcity
        last edited by A Former User

        @madebyelmcity
        https://github.com/ianperrin/MMM-ModuleScheduler#scheduling-notifications
        shows how to occur notification with payload.

        1 Reply Last reply Reply Quote 0
        • ? Offline
          A Former User @madebyelmcity
          last edited by

          @madebyelmcity
          I was on the way so I couldn’t explain in detailly.
          If you are using https://github.com/ianperrin/MMM-ModuleScheduler , (Personally, I don’t use it, so I might be wrong)
          This could work; Haven’t tested, but…

          {
            module: 'MMM-ModuleScheduler',
            config: {
              notification_schedule: {
                notification: 'YOUTUBE_CONTROL', 
                schedule: '30 9 * * *', 
                payload: {
                    type: "notification", 
                    command: 'pauseVideo'
                }
              }
            }
          },
          
          M 1 Reply Last reply Reply Quote 0
          • M Offline
            madebyelmcity @Guest
            last edited by

            @Sean Thanks! I’ll try it out and report back. Really appreciate the assistance.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • 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