The loop attribute of audio is simulated in chrome, and the error cannot be run correctly.

in Chrome 65.0.3325.181 (official version) (64-bit), the loop attribute of the audio tag does not take effect. Write the corresponding logic and report an error after execution.

the code is as follows:

//html
<audio id="backgroundAudio" src="./resource/sound/bgMusic.mp3" autoplay loop/>
//js
var audio = $("-sharpbackgroundAudio")[0];
audio.addEventListener("timeupdate",()=>{
    if(audio.paused){
        return;
    }
    if(audio.currentTime >= audio.duration - 1){
        audio.currentTime = 0;
        const p = audio.play();
        //
        // if (p && (typeof Promise !== "undefined") && (p instanceof Promise)) {
        //     p.catch(e => log(e));
        // }
    }
});

the error message is as follows:
Uncaught (in promise) DOMException: The play () request was interrupted by a call to pause ().

I want to know why this error occurs, why it executes correctly after adding comment code, and why the loop property does not take effect.

The

loop attribute is due to a problem with the audio file, which has been resolved

Feb.27,2021

the loop property is valid. My version is 65.0.3325.181 (official version) (32-bit)

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-1e409e8-43844.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-1e409e8-43844.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?