Read the statement by Michael Teeuw here.
Scheduling a YouTube video to start/stop via MMM-Remote-Control
-
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!
-
@madebyelmcity
https://github.com/ianperrin/MMM-ModuleScheduler#scheduling-notifications
shows how to occur notification with payload. -
@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' } } } },
-
@Sean Thanks! I’ll try it out and report back. Really appreciate the assistance.