I would like to ask you how the current Google browser version of the audio can be played automatically on the home page?

the code is as follows

$(document).ready(function () {
    var audioElement = document.createElement("audio");
    audioElement.setAttribute("src", $(".active-song").attr("data-src"));
    var tl = new TimelineMax();
    tl.to(".player__albumImg", 3, {
        rotation: "360deg",
        repeat: -1,
        ease: Power0.easeNone
    }, "-=0.2");
    tl.pause();
    //
    if ($(".player").hasClass("play")) {
        $(".player").removeClass("play");
        audioElement.pause();
        TweenMax.to(".player__albumImg", 0.2, {
            scale: 1,
            ease: Power0.easeNone
        })
        tl.pause();
    } else {
        $(".player").addClass("play");
        audioElement.play();
        TweenMax.to(".player__albumImg", 0.2, {
            scale: 1.1,
            ease: Power0.easeNone
        })
        tl.resume();
    }
    $(".player__play").click(function () {
        if ($(".player").hasClass("play")) {
            $(".player").removeClass("play");
            audioElement.pause();
            TweenMax.to(".player__albumImg", 0.2, {
                scale: 1,
                ease: Power0.easeNone
            })
            tl.pause();
        } else {
            $(".player").addClass("play");
            audioElement.play();
            TweenMax.to(".player__albumImg", 0.2, {
                scale: 1.1,
                ease: Power0.easeNone
            })
            tl.resume();
        }
    })

errors will be reported in Google browser
DOMException: play () failed because the user didn"t interact with the document first

Apr.07,2021

go to Baidu first. As soon as you paste the error code, the whole world will find the answer. Chrome 66 forbids automatic sound playback. How should the developer respond?


has the problem been solved?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b406ae-2b875.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b406ae-2b875.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?