question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Video examples get errors

See original GitHub issue
Description of the problem

It seems like most of the samples with video get errors at the beginning, at least when run locally (which means there’s a timing issue?)

three.module.js:15 WebGL: INVALID_VALUE: tex(Sub)Image2D: video visible size is empty

I don’t know what the correct way to use video in WebGL is honestly and I’m not sure anyone actually does. It seems like every 2-3 years browsers break it again. Checking the WebGL conformance tests, they wait for video.currentTime to be > 0 before calling texImage2D but I suspect that’s just some voodoo that made the tests run and not the official way you’re supposed to do it. Though maybe if it’s good enough for the tests?

I don’t think you’ll see this on the website as it seems to be related to timing. If I use servez or http-server to serve the three.js folder and go to http://localhost:8080/examples and run webgl_video_panorama_equirectangular.html then I see the errors

ScreenFlow

Note: It’s Chromium only that has the issue but checked 2 macs and a windows and they all get the errors.

Three.js version
  • Dev
Browser
  • All of them
  • Chrome
  • Firefox
  • Safari
OS
  • All of them
  • Windows
  • macOS
  • [?] Linux
  • [?] Android
  • iOS
Hardware Requirements (graphics card, VR Device, …)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
greggmancommented, Aug 13, 2020

This issue is already solved is it not? The code was updated to use requestVideoFrameCallback where it exists which solves the issue in Chrome. Firefox and Safari didn’t have the issue previously right?

1reaction
looeeecommented, Aug 12, 2020

I’ve previously (just a few days ago actually) spent some time trying to solve this using 'loadedmetadata' and 'loadeddata' events. The problem is that in most cases, these events have already fired by the time you access the video in JS.

Added this code to the fiddle:

var video = document.getElementById( 'video' );
video.addEventListener('loadedmetadata', (event) => {
  console.log('meta data loaded')
})

video.addEventListener('loadeddata', (event) => {
   console.log('data loaded')
})
video.play();

After reloading about ten times I was about to get both events to fire one time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

15 Most Common Video Errors + How to Fix Them
Part 1: Common Video Errors and Solutions ; Issue 3: Missing or Choppy Video · choppy videos ; Issue 4: VLC Player can't...
Read more >
Percent Error Made Easy! - YouTube
This video explains how to calculate the percent error of an experiment the simple way!
Read more >
Basics of Error Handling in JavaScript - Tutorial - YouTube
In this video I'll be showing you the absolute basics of handling errors in JavaScript, which is perfect for anyone learning JavaScript or ......
Read more >
HTMLMediaElement.error - Web APIs - MDN Web Docs
Examples. This example establishes a video element and adds an error handler to it; the error handler logs the details to console.
Read more >
The 5 most common errors when embedding videos - Mynd
You want to engage people with your new video, but then: error message! ... For example, to share a YouTube video directly from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found