{"action":"opened","issue":{"url":"https://api.github.com/repos/videojs/video.js/issues/2831","labels_url":"https://api.github.com/repos/videojs/video.js/issues/2831/labels{/name}","comments_url":"https://api.github.com/repos/videojs/video.js/issues/2831/comments","events_url":"https://api.github.com/repos/videojs/video.js/issues/2831/events","html_url":"https://github.com/videojs/video.js/issues/2831","id":118023810,"number":2831,"title":"\"videojs is not a function\" error - in 5.2.1","user":{"login":"MattS2K","id":15941584,"avatar_url":"https://avatars.githubusercontent.com/u/15941584?v=3","gravatar_id":"","url":"https://api.github.com/users/MattS2K","html_url":"https://github.com/MattS2K","followers_url":"https://api.github.com/users/MattS2K/followers","following_url":"https://api.github.com/users/MattS2K/following{/other_user}","gists_url":"https://api.github.com/users/MattS2K/gists{/gist_id}","starred_url":"https://api.github.com/users/MattS2K/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MattS2K/subscriptions","organizations_url":"https://api.github.com/users/MattS2K/orgs","repos_url":"https://api.github.com/users/MattS2K/repos","events_url":"https://api.github.com/users/MattS2K/events{/privacy}","received_events_url":"https://api.github.com/users/MattS2K/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-20T11:44:33Z","updated_at":"2015-11-20T11:44:33Z","closed_at":null,"body":"This error happens if you use auto-setup and it is initially called before the page has completed loading. Tracking through, it is caused by the following code:\r\n\r\n```\r\nvar autoSetup = function autoSetup() {\r\n  \r\n     //cut code\r\n\r\n        // If getAttribute isn't defined, we need to wait for the DOM.\r\n      } else {\r\n          autoSetupTimeout(1);\r\n          break;\r\n        }\r\n    }\r\n\r\n    // No videos were found, so keep looping unless page is finished loading.\r\n  } else if (!_windowLoaded) {\r\n      autoSetupTimeout(1);\r\n    }\r\n  };\r\n\r\n// Pause to let the DOM keep processing\r\nvar autoSetupTimeout = function autoSetupTimeout(wait, vjs) {\r\n    videojs = vjs;\r\n    setTimeout(autoSetup, wait);\r\n};\r\n\r\n```\r\n\r\nThe calls to autoSetupTimeout are resetting videojs to undefined.\r\n"}}