This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Audio object
#1
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);
  }
});
Reply
#2
Hi Joep,

Have you tried this one?

https://forum.logicmachine.net/showthrea...20#pid7920

Note that playing audio on iOS is only allowed after a user input

BR,

Erwin
Reply
#3
(17.12.2019, 17:09)Erwin van der Zwart Wrote: Hi Joep,

Have you tried this one?

https://forum.logicmachine.net/showthrea...20#pid7920

Note that playing audio on iOS is only allowed after a user input

BR,

Erwin

Hi Erwin,

That works quit well thanks Smile
Next thing is to get this functionality in the controller by default..
Reply


Forum Jump: