-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading images using workers #298
base: master
Are you sure you want to change the base?
Conversation
Excellent work. Just wondering is this working in your end? In my environment (Chrome v80) I'm getting Uncaught (in promise) DOMException: The source image could not be decoded. (fetchImageUsingOffscreenCanvas.js:64) At first I'm under impression this might due to the incompatibility between |
Thank you, @Novezeil Yes, on my end, with this exact code it works, same version of Chrome as you, but all my images are JPEG. I might be able to investigate why it fails on creating an empty scene. |
Thanks @Aykelith. If possible might be also worth to look at if there's any reason blocking producing release build. (I'm getting same result as CI, but Meanwhile I'm wondering do you have any release/dev build could potentially share? Very curious to see how much performance gain we are getting by utilizing workers. Thanks. |
I had some free time and I fixed the release build. Looks like the release build require stricter syntax rules. When I will have more time I will invest more to resolve the problems. EDIT: Here is the release build (I hope this is what you need) |
This is interesting, thanks for investigating. I'm wondering whether we could get the same benefit without using a worker, by leveraging the Since Did you, by any chance, also try out this approach? How does it compare? |
Now that workers are available pretty everywhere I think it would benefit
marzipano
to use them. I created this fork and it works on Chrome and only on Chrome will work until other browsers will implementOffscreenCanvas
andcreateImageBitmap
, but the workers files must be moved to the public_html/static folder of the website for theWorker
constructor to be able to load them.I created 3 workers:
createImageBitmap
and return the image bitmap; this worker is used when there is no need of transformations on the image;createImageBitmap
and then transform it usingOffscreenCanvas
.These workers are created in the constructor of
loaders/HtmlImage.js
where I check which workers are available on the current browser. If the features required for workers are not available we use the current implemented method using<img>
I know that there should be some refactoring done and I want to know what I need to refactor.
Also I don't what is the best method to handle the workers files that must be in the public_html/static folder.
I also create a worker for just fetching the the image data and returning a
Blob
and then load it normally using<img>
but I don't see performance gains from doing this.