loadedbytes action is showing incorrect value

  • When I call the loadedbytes value for a small video (under ~10mb), it returns the same value as the totalbytes action which means that the video should be completely loaded.


    But when I check the network console on Chrome, it shows that the video is still being downloaded from the source. Does anyone know why krpano says the video is completely loaded?

  • because the browers do not give accurate feedback...
    there is no loop, reporting you every byte... the data more or less come in chunks.
    also with large files the info is not exact i think, but there you get more steps and it seems/probably is more accurate.
    if you really need an exact loader you have to do it yourself in js, i guess (preload the file)

  • if you really need an exact loader you have to do it yourself in js, i guess (preload the file)

    How would you do that? The best way would be to add a "progress" event listener to the request that is loading the video, but it does not seem like we have access to that part of the code...

    Would just need to add something like this...


    Code
    var req = new XMLHttpRequest();
    req.addEventListener('progress', function(event) { 
    	if (event.lengthComputable) { 
    		var percentComplete = (event.loaded / event.total) * 100; 
    		console.log(percentComplete.toFixed(2)); 
    		if(percentComplete === 100) { 
    			console.log('Loading Complete'); 
    		}	
    	}
    }, false);
  • Ah, yes that is what I have currently as well for the initial load.

    However, I am asking about the incorrect loadedbytes values because I am trying to create a speed test that upgrades/downgrades resolutions depending on the user's network speeds. Whenever the lower qualities are played (360 and 480), krpano believes the video is completely loaded, and therefore I am unable to calculate the buffering rate of the video.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!