-
Notifications
You must be signed in to change notification settings - Fork 105
OT is not defined #1
Comments
@alveshelio Thanks for using opentok-react! You would get
If you have done that, maybe you can give me more information about your setup because nothing else comes to mind. |
Hi @aiham, I had not added this script.
I've added <script src="//static.opentok.com/v2/js/opentok.min.js"></script> to my main.html file, this is what I have:
Because the tutorial says, include opentok.js before your application and I've checked your example and you are indeed loading this before the bundle.js file. However, I'm using Meteor and in my html file I do not have the bundle.js file that is called. When I add <script src="//static.opentok.com/v2/js/opentok.min.js"></script> right before the tag, I get this error: |
@alveshelio I just deleted my previous comment, I believe it's wrong. I think you should load opentok.js using https:
I will update the README now. |
Hi @aiham, Unfortunately with both methods: I'm still getting the same error. I've tried on Chrome, Firefox and Safary and I have the same error in all three. |
@alveshelio What if you try adding the following before
This is setting a Content Security Policy which trusts static.opentok.com. See:
I suspect Meteor is setting a Content Security Policy which only trusts the same origin. Can you open your page with the dev tools open, navigate to the Network tab and click on the request which loads the HTML page. Can you see if there is a response header called Content-Security-Policy there? |
so I've added and checked the Network tab, in "XHR" I don't see anything related to Content-Security-Policy, in "Other" i see "opentok.min.js" withs Status "(blocked:scp)" |
@alveshelio The CSP header will be in the network request for the HTML page itself, not XHR. Open the network tab and press refresh, it should be the first request in the list. |
I don't see any SCP at the top, here's what I have: http://prntscr.com/e8fn9l The request to opentok.min.js comes almost at the end, check here: http://prntscr.com/e8fmzp, |
@alveshelio What about before Clipper.js? There must be a HTML page that loads first. You need to press refresh after you open the dev tools |
I haven't got much experience with Meteor so I can't say for sure, but it's probably adding the CSP header. You will likely need to add static.opentok.com to the list of trusted domains for static content. There is likely a module to help you with this: https://blog.meteor.com/defense-in-depth-securing-meteor-apps-with-content-security-policy-8fd5ffa503ee |
Hi @aiham, Thank you very much for your precious help. Actually I was getting this error because I was using package: browser-policy, you've put me in the right track. I simply need to add this to my code:
Here's an article talking about it: Using the Browser Policy Package Thank you again for your help. |
Hi,
I'm trying out TokBox with Meteor and React and I'm running into a problem.
In my file I've imported the following:
import { OTSession, OTPublisher, OTStreams, OTSubscriber, createSession } from 'opentok-react';
And I have this code:
However, whenever I start a session, I get this error
_Exception from Tracker recompute function:
meteor.js?hash=e3f53db…:930 ReferenceError: OT is not defined
at createSession (modules.js?hash=97a78a9…:64952)
at OTSession.componentWillMount (modules.js?hash=97a78a9…:64850)
at modules.js?hash=97a78a9…:16742
at measureLifeCyclePerf (modules.js?hash=97a78a9…:16469)
at ReactCompositeComponentWrapper.performInitialMount (modules.js?hash=97a78a9…:16741)
at ReactCompositeComponentWrapper.mountComponent (modules.js?hash=97a78a9…:16652)
at Object.mountComponent (modules.js?hash=97a78a9…:9577)
at Object.updateChildren (modules.js?hash=97a78a9…:16215)
at ReactDOMComponent._reconcilerUpdateChildren (modules.js?hash=97a78a9…:15731)
at ReactDOMComponent.updateChildren (modules.js?hash=97a78a9…:15835)
Any idea what could be causing this problem?
The text was updated successfully, but these errors were encountered: