I need to use a sleep for 8 seconds after the music start and finish with autostart/autoplay, right now the music loading in background when finish without wait 8 seconds. It is not working but the goals is sleep for 8 seconds before restart again the music in background.

  $rand_no=mt_rand (10000,1000000);
        $content='<p><script>
            jQuery(function() {
                jQuery("#lbg_audio1_html5_'.$row["id"].$rand_no.'").audio1_html5({
                    skin:"'.$row["skin"].'",
                    initialVolume:'.$row["initialVolume"].',
                    autoPlay:'.$row["autoPlay"].',
                    loop:'.$row["loop"].',
                    shuffle:'.$row["shuffle"].',
                    continuouslyPlayOnAllPages:'.$row["continuouslyPlayOnAllPages"].',
                    playerPadding:'.$row["playerPadding"].',
                    playerBg:"#'.$row["playerBg"].'",
                    bufferEmptyColor:"#'.$row["bufferEmptyColor"].'",
                    bufferFullColor:"#'.$row["bufferFullColor"].'",
                    seekbarColor:"#'.$row["seekbarColor"].'",
                    volumeOffColor:"#'.$row["volumeOffColor"].'",
                    volumeOnColor:"#'.$row["volumeOnColor"].'",
                    timerColor:"#'.$row["timerColor"].'",
                    songAuthorTitleColor:"#'.$row["songAuthorTitleColor"].'",
                    showRewindBut:'.$row["showRewindBut"].',
                    showPlayBut:'.$row["showPlayBut"].',
                    showPreviousBut:'.$row["showPreviousBut"].',
                    showNextBut:'.$row["showNextBut"].',
                    showPlaylistBut:'.$row["showPlaylistBut"].',
                    showVolumeBut:'.$row["showVolumeBut"].',                
                    showVolumeSliderBut:'.$row["showVolumeSliderBut"].',
                    showTimer:'.$row["showTimer"].',
                    showSeekBar:'.$row["showSeekBar"].',
                    showAuthor:'.$row["showAuthor"].',
                    showTitle:'.$row["showTitle"].',
                    showPlaylist:'.$row["showPlaylist"].',              
                    showPlaylistOnInit:'.$row["showPlaylistOnInit"].',              
                    playlistTopPos:'.$row["playlistTopPos"].',              
                    playlistBgColor:"#'.$row["playlistBgColor"].'",
                    playlistRecordBgOffColor:"#'.$row["playlistRecordBgOffColor"].'",
                    playlistRecordBgOnColor:"#'.$row["playlistRecordBgOnColor"].'",
                    playlistRecordBottomBorderOffColor:"#'.$row["playlistRecordBottomBorderOffColor"].'",
                    playlistRecordBottomBorderOnColor:"#'.$row["playlistRecordBottomBorderOnColor"].'",
                    playlistRecordTextOffColor:"#'.$row["playlistRecordTextOffColor"].'",
                    playlistRecordTextOnColor:"#'.$row["playlistRecordTextOnColor"].'",
                    numberOfThumbsPerScreen:'.$row["numberOfThumbsPerScreen"].',
                    playlistPadding:'.$row["playlistPadding"].',
                    showPlaylistNumber:'.$row["showPlaylistNumber"].',
                    isSliderInitialized:'.$row["isSliderInitialized"].',
                    isProgressInitialized:'.$row["isProgressInitialized"].'     
                });
            });
        </script>   
        '.$new_div_start.'<div class="audio1_html5">

                <audio id="lbg_audio1_html5_'.$row["id"].$rand_no.'" preload="'.$preload_aux.'">
                      <div class="xaudioplaylist">'.$playlist_str.'</div>
                      <audio controls="controls" onloadeddata="var audioPlayer = this; setTimeout(function() { audioPlayer.play(); }, 8000)">
                  No HTML5 audio playback capabilities for this browser. Use <a href="https://www.google.com/intl/en/chrome/browser/">Chrome Browser!</a>    
                </audio>     
         </div>             
        <br style="clear:both;">'.$new_div_end.'</p>';

        return str_replace("rn", '', $content);
    }

Read more here: Audio set timeout music background


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: