CRISPR
CRISPR

Reputation: 1126

How to make "Openseadragon" prioritize tile requests?

I am using Openseadragon to show Whole Slide Images running on a server. When internet connection is not very fast and navigating inside the image, I have many requests pending on the queue that needs to be finished until the specific area I want to see is loaded and rendered. Is there a way to prioritize new requests over older? I think it would really improve User Experience.

I tried to change some Openseadragon parameters to make User Experience better but I think there should be a better solution.

Also I found the code below that cancels the requests but also clears everything that has already render and cached so every tile should load again.

I also tried to just cancel all pending requests but there are NO new requests starting so the canceled tiles never load.

window.stop()
viewer = viewport.viewer
var oldImage = viewer.world.getItemAt(0);
var oldBounds = oldImage.getBounds();
var oldSource = oldImage.source;
// Modify tile source as needed
viewer.addTiledImage({
   tileSource: oldSource,
   x: oldBounds.x,
   y: oldBounds.y,
   width: oldBounds.width, // It'll do height automatically based on aspect ratio
   success: function() {
       viewer.world.removeItem(oldImage);
   }
});

I want to cancel pending requests and make new ones or just prioritize new requests over older so the user can see new tiles faster and load older tiles on the background. I don't want the user to just wait for the image to load and keep waiting to load tiles that just passed through that need to load before the actual tiles that they are looking to.

Any thoughts? Thank you in advance.

Upvotes: 0

Views: 677

Answers (1)

iangilman
iangilman

Reputation: 2174

By default, OpenSeadragon tries to load as many images simultaneously as the browser will allow. If the user navigates away while those images are in transit, it doesn't cancel their loading. You can adjust this for low bandwidth by asking it to limit tile loads to 1 at a time, by including imageLoaderLimit: 1 in your options when you create your viewer.

Upvotes: 0

Related Questions