javascript - Cannot read HTML5 video from local cache after using video.load() -
i want play list of mp4 videos local cache save network traffic. pretty sure videos in cache because when manually switch file 1.mp4,2.mp4,3.mp4,4.mp4 on video source, "network" panel of chrome development tools shows file served cache returns http 206.
when try use javascript video playlist, after new video loaded, chrome start miss cache , try video internet , hence cost network traffic.
video.load();
is there way make chrome load video cache?
browser: chrome ver.50
html:
<div id="video"> <video id="video-ads" autoplay preload="none"> <source id="video-source" src="https://foo.bar.net/video/1.mp4"> </video> </div>
javascript:
var cdn = "https://foo.bar.net"; var playlist = new array( cdn + "/video/1.mp4", cdn + "/video/2.mp4", cdn + "/video/3.mp4" ); var videocount = playlist.length; var = 0; video = document.getelementbyid("video-ads"); videosource = document.getelementbyid("video-source"); video.addeventlistener('ended', function() { if (i == videocount) = 0; var nextvideo = playlist[i++]; videosource.setattribute("src", nextvideo); video.load(); video.play(); });
Comments
Post a Comment