Defer video stream


I use the stream service, but I want to defer the loading. Basically to reduce the time for load the page.

Now I use this code:

<stream src="2b56dce9458aa30688fdf992a21973XXX" controls poster="https://XXXX/public/[email protected]"></stream>
<script data-cfasync="false" defer type="text/javascript" src=""></script>

when I check the performance with gtmetrix, I see:

video.mpd >> 200 >> >> 2.3 KB >> 800 ms to load.

is possibile to load the video (the palyer I think) later? after page is loaded?


I’m currently testing this:

<stream src="2b56dce9458aa30688fdf992a219XXXX" controls poster="https://XXXX/public/[email protected]"></stream>

<script type="text/javascript">
function downloadJSAtOnload() {
var element = document.createElement("script");
element.src = "";
if (window.addEventListener)
window.addEventListener("load", downloadJSAtOnload, false);
else if (window.attachEvent)
window.attachEvent("onload", downloadJSAtOnload);
else window.onload = downloadJSAtOnload;

and I scratched 400 ms to load

it seems strange to me that nobody cares, however, this is the solution that I have adopted now, the script is downloaded only on click on the poster, and the video starts with autoload:

   <stream src="2b56dce9458aa30688fdf992a219xxxx" autoplay muted controls></stream>
    <div id="video-poster">
	<a href='#' id='scriptdl'>
		<img border="0" alt="video-player" src="https://xxxx/poster.png" width="100%" height="100%">


<script type="text/javascript">
  var scriptdl = document.getElementById('scriptdl');
  scriptdl.onclick = function(){

  var element = document.getElementById("video-poster");

  var script = document.createElement("script");
  script.type = "text/javascript";
  script.src = ""; 
  return false;


div.hidden { display: none; }