流PNG使用URLStream间歇时,服务器陷入困境 [英] Streamed PNG using URLStream intermittent when server is bogged

查看:167
本文介绍了流PNG使用URLStream间歇时,服务器陷入困境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

于是我用普通类加载器加载我的图片,不过.close功能显然打破了这个类,如果它被称为它不会停止下载。

So I used the regular loader class to load my images however the .close function is apparently broke in that class and it will not stop the download if it is called.

在我来说,我需要能够取消加载的用户可以可能通过图像的很多被滚动的,如果不取消,可能需要几分钟的时间来赶上滚动位置。

In my case I need to be able to cancel loading as the user could possibly be scrolling through alot of images and the if not canceled it can take a few minutes to catch up to the scroll position.

于是经过研究URLStream类似乎根治这个问题,我发现了一个很好的流类这里

So after research the URLStream class seems to cure this problem and I found a good streaming class here

这个类的工作方式很不错,除了当在服务器上的重负载造成的滞后。
当这种情况发生的滞后班会分派完成事件还图像将不显示。
看着下载与HTTPFox显示实际上图像没有得到加载。

This class works very nice except when there is heavy load on the server causing lag.
When this lag happens the class will dispatch the complete event yet the image will not show.
Watching the download with HTTPFox shows the image in fact does get loaded.

我假设有某种延迟的问题与URLStream类和这个类的作者试图用setTimeout的方法来纠正它。 我也试过推迟完成事件的调度使用定时器,而不是调度,直到如果(this.width!= 0)检测,这似乎运行得更好。 但它仍然是困扰我只是不经常发生。

I assume there is some kind of delayed issue with the URLStream class and the author of this class tried to correct it using the setTimeout method. I also tried delaying the dispatching of the complete event using a timer and not dispatching until if( this.width != 0 ) was detected and this seemed to work much better. But it is still haunting me just not as often.

有谁知道这或修正的流PNG图像和JPG格式?另一种解决方案

Does anyone know of a fix for this or another solution for streaming PNGs and JPGs?

推荐答案

我可以看到,有在code一些地方的条件可以进行检查。但是,对于一个简单的解决方案,它可能是最好使用一个更发达的系统,如 BulkLoader

I can see that there are some places in that code where conditions could be checked. But for a simple solution, it may be better to use a more developed system, like BulkLoader.

这篇关于流PNG使用URLStream间歇时,服务器陷入困境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆