1

I think I'm going crazy, all my searches indicate I am doing this properly, but I am still getting the opposite results. I have two scripts. The first one is the library (RecordRTC), and the second one is my javascript using the library. No matter what I do, my script loads first - and the library loads second. And my browser keeps showing (in the timeline) that this is true, and my script keeps showing the error "RecordRTC not defined" - that my script is calling the library before it has loaded.

Below is ALL the html code I'm using. Please send help.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Testing RecordRTC</title>
<script type='text/javascript' src="http://RecordRTC.org/latest.js"></script>
</head>
<body>
    <div id="videos-container">
        <video id="video"></video>
    </div>
  <script type='text/javascript' src="./js/videos02.js" defer></script>
</body>
</html>
Michael S
  • 726
  • 1
  • 10
  • 23
  • Quentin has given you the correct answer. Also see: [Is it wrong to place the – Yogi Jun 22 '15 at 16:03
  • Thanks Roberto. I edited the code to reflect your and Quentin's help. But even with this, I'm still getting the same behavior I described. Any ideas? – Michael S Jun 23 '15 at 01:37

1 Answers1

3

Use a validator.

async and defer are boolean attributes. They are either present or they are omitted. You cannot give them the values true and false. async=false is an error that will be error corrected to async is on for this script.

The library is being called before it is loaded because you have said that it can be loaded async and defer so the browser isn't waiting for it before loading the other script.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Thank you Quentin. I edited the code to fix the async and defer. And I put the bottom script back into the tag. But I'm still seeing the same behavior I originally described. This is actually close to how I had it to begin with which caused me to find the async=false suggestion. I'm certain this should be working, but can't seem to understand why it isn't. – Michael S Jun 23 '15 at 01:36
  • When [I try it](http://jsbin.com/senujiqike/1/edit?html,output) I just get "Uncaught MediaStream is mandatory" which is a different error entirely. – Quentin Jun 23 '15 at 07:08
  • I found the answer... It only appeared to be not working because my built-in camera wasn't functioning :P Both the error message and my browsers' developer tools made it appear to me as if my trouble was from improper loading order. I had an actual load-order issue once before and that's why I thought I was going crazy - I attributed the error to the wrong thing. Thank you all for your help! – Michael S Jun 23 '15 at 21:49