how to play audio using code automatically in native javascript  , like as in traccar web when new event received?
there is an example of code ; 
I am using the library howler.
        const alertSound = new Howl({
            src: ["{%static 'sounds/modern_src_resources_alarm.mp3' %}"],
        });
        let numAlertsToShow = 5; 
        let alertsShown = 0;
        let allAlerts;
        function fetchAlerts() {
            
            $.ajax({
                type: "GET",
                url: "/amnir/api/alerts/",
                success: function (response) {
                  
                    alertSound.play(); 
             }
            });
            
        }
The audio not played.
how to play audio using code automatically in native javascript , like as in traccar web when new event received?
there is an example of code ;
I am using the library howler.
const alertSound = new Howl({ src: ["{%static 'sounds/modern_src_resources_alarm.mp3' %}"], }); let numAlertsToShow = 5; // Change this number to adjust the number of alerts to show let alertsShown = 0; let allAlerts; function fetchAlerts() { // $(document).ready(function () { $.ajax({ type: "GET", url: "/amnir/api/alerts/", success: function (response) { alertSound.play(); // Play sound for new alert } }); // }); }The audio not played.