javascript - getting 206 partial content while loading .mp3 files -
I have a web app that loads instagram images and creates a slideshow with background sound while the images Loading, a pre-loader is run to show processing. But it does not fully load the MP3 file and when I check in the browser console, it got 206 partial content
. So, to click on the play button, I have to wait a few seconds so that the music is completely full to run the slideshow.
console.log ('loading theme:' + folder); $ .ajaxSetup ({cache: false}); $. ($ .getScript (epic.getFrontendURL () + "Animation /" + folder + "/js/data.js"), $ .getScript (epic.getFrontendURL) + "Animation /" + Folder + "/ $ (Deferred.resolve);}) .done (function () {// Some methods sound_bg.src = epic.getFrontendURL () + "sound /back.mp3?});
So, it is related in some way, with done
, which delays the process.
This behavior is normal. To reduce bandwidth usage browsers use an HTTP chain request to load audio and video files.
If you want the browser preloading the audio, set the preload
attribute to auto
on the audio element:
& lt; audio src = ".." preload = "auto">
Comments
Post a Comment