Based on MMM-Sounds but rather than playing the sound locally it gets played in browser for those who host their MagicMirror on a separate server.
NOTE: Chrome blocks the autoplay of sounds until you interact with the site. Adding --autoplay-policy=no-user-gesture-required should do the trick, here is how I launch mine on my pi.
chromium-browser --noerrdialogs --autoplay-policy=no-user-gesture-required --kiosk --incognito https://dash.url.com
- Navigate into your MagicMirror's
modules
folder and executegit clone https://github.com/sigel/MMM-Sounds2.git
To use this module, add it to the modules array in the config/config.js
file:
modules: [
{
module: 'MMM-Sounds2',
config: {
startupSound: true, // Play sound on startup
alertSound: true, // Play alert sound when alert module is triggered
quietTimeStart: '23:00', // 11pm
quietTimeEnd: '07:00' // 7am
}
}
]
The following properties can be configured:
Option | Description |
---|---|
startupSound |
Play sound after module startup Possible values: boolean
Default value: true
|
alertSound |
Play sound for alert module Possible values: boolean
Default value: true
|
defaultDelay |
The default delay before playing the file in milliseconds Possible values: integer
Default value: 10
|
quietTimeStart |
The 24 hour and minute start of Quiet time Possible values: string
Default value: null
|
quietTimeEnd |
The 24 hour and minute end of Quiet time Possible values: string
Default value: null
|
debug |
Enable to display more debug messages in console Possible values: bool
Default value: false
|
This module supports not playing sounds during a quiet time, if BOTH the quietTimeStart
and quietTimeEnd
config
options are specified.
The values for these times are HH:mm and must be in 24 hour format. Examples:
00:30
- 12:30am06:30
- 6:30am14:11
- 2:11pm23:30
- 11:30pm
From another module you can tell this module to play a sound in 2 ways:
In your module:
self.sendNotification('PLAY_ALERT', 'alert');
or also specifying a delay:
self.sendNotification('PLAY_ALERT', {sound: 'alert', delay: 1000}); // 1 second delay
alert
announcement
bells
chord
notify
startup
synth