0

I'm creating a webserver on raspi that can be access by my webview in android phone. This is my JS.

setInterval(function() {

    notif();
    $("#position").load('refresh.php');

},1000);

function notif() {

    var pos = $('.status').text();
    var audio = new Audio('alarm.mp3');

    if(pos == "Out") {
    audio.play();
    }
}

When I access my webserver from different laptop it plays the audio. But it is not working on android application webview even in browser. I tried to put the audio.play(); code in a button and open it in a webview and its working fine. Is it a webview problem or js Can you help me. Thank you.

Boris Schegolev
  • 3,601
  • 5
  • 21
  • 34
  • Maybe you can find some help here: https://stackoverflow.com/questions/3795276/android-webview-playing-audio-with-javascript – Kyrre Nov 23 '18 at 08:06
  • My sound notif is working on browser on pc. But in android, its not working. I think the link you gave me is creating notif in android studio – Gerald Manibale Nov 23 '18 at 08:12

0 Answers0