Audio object - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Audio object (/showthread.php?tid=2393) |
Audio object - Joep - 17.12.2019 I use the custom Javascript below to play an audio file (doorbell). Unfortunately it will not work cross browser since the play function isn't allowed from script any longer for Safari (IOS) and Firefox. Only in Chrome it's still working so far. Does any of you know a better solution to play audio from a simple Javascript? $(function() { if (typeof grp != 'undefined') { grp.listen('4/1/1', function(object, state) { if (state == 'value') { var myaudio = new Audio('https://knxgroep.nl/plugins/deurbel.mp3'); myaudio.play(); } }, true); } }); RE: Audio object - Erwin van der Zwart - 17.12.2019 Hi Joep, Have you tried this one? https://forum.logicmachine.net/showthread.php?tid=1314&pid=7920#pid7920 Note that playing audio on iOS is only allowed after a user input BR, Erwin RE: Audio object - Joep - 18.12.2019 (17.12.2019, 17:09)Erwin van der Zwart Wrote: Hi Joep, Hi Erwin, That works quit well thanks Next thing is to get this functionality in the controller by default.. |