A-Assets timeout malfunction
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 17.6k
- Forks
- 4.4k
- PR merge metrics
- No merged PRs in 30d
Description
Description:
- A-Frame Version: 0.8.2
- Platform / Device: Chrome
- Reproducible Code Snippet or URL: Any with timeout
Currently setting timeout to 1 will cause a WebGL error for video about non-power of two textures, because the texture isn't loaded yet. onloadeddata should at least be called once before play and resolve() can be called on first onloadeddata callback.
Next to that, the buffer might never reach 100% of the video length, and thus the user might have to wait -say- 2.5 seconds out of 3 seconds (when timeout = 3). This is expected behaviour because most browsers only buffer a very small portion of the video. Also this is very browser dependent and will lead to different behaviours across browsers.
An alternative could be to update the timeout when onprogress is called, with -say- 1 second instead. Each progress call grants another 1s timeout. This way the user only waits a max of 1 second after buffer loading ends. But this could also behave differently across browsers.
What usually is done to fix the buffer loading ending early, is to play through the entire audio/video first, which will ensure the entire clip is loaded in cache. However, with cubemap videos the filesize will be so large it might very well be cleared from cache again anyway.
It's probably better to at least disable timeout functionality by default (instead of 3000ms). Right now, most browsers will wait 3 seconds while actual loading ends very early.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the timeout behavior with an A-Frame asset containing video in Chrome, then inspect the A-Assets timeout handling around onloadeddata, onprogress, buffering, and resolve(). Compare the proposed timeout behaviors and define done as avoiding the WebGL error while making video loading completion consistent across browsers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics, frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100