Skip to content

Commit

Permalink
fix: allow Video.js to be required in an env without setTimeout (vide…
Browse files Browse the repository at this point in the history
…ojs#7247)

Some JavaScript environments don't implement setTimeout, which causes Video.js to fail on require. Instead, move our Dom.isReal() check earlier to before we call setTimeout.
  • Loading branch information
tf authored and edirub committed Jun 8, 2023
1 parent 852ded8 commit b21fb14
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/js/setup.js
Expand Up @@ -72,6 +72,11 @@ const autoSetup = function() {
* The videojs library function
*/
function autoSetupTimeout(wait, vjs) {
// Protect against breakage in non-browser environments
if (!Dom.isReal()) {
return;
}

if (vjs) {
window['ntv-videojs'] = vjs;
}
Expand Down

0 comments on commit b21fb14

Please sign in to comment.