TokBox API Not Working when moved to x10hosting

Status
Not open for further replies.

pk004233

New Member
Messages
1
Reaction score
0
Points
1
Hi, for my final year project at University I've created a social networking site for the Very Elderly. I've just transferred the website files from local WAMP config to a Web Hosted CPanel config today. Everything is all up and running apart from the Tokbox API. This is a video chat API which allows the web page to interact with the Tokbox servers to provide a video hosting experience. This was, and still is, working on my local WAMP server config. However, this isn't working on the CPanel config.

From what I can see, the API has been executed because the window is loaded up and a spinning circle indicating something is loading, however nothing is.

Below is the API Source Code. I was wondering if anyone's had issues like this before? I REALLY need to get this to work on a web hosted platform as I'm demoing this product next week.


Kindest regards,
Tim

HTML:
<html>
  <head></head>
  <body>
    <div id='myPublisherDiv'></div>
    <div id='subscribersDiv'></div>
   
    <script src='//static.opentok.com/v2/js/opentok.min.js'></script>
    <script>
      var apiKey = '45544512';
      var sessionId = '1_MX40NTU0NDUxMn5-MTQ1OTk1ODQ3ODcwOH56OW5OcGMrTUorQlhNK1lpRGhQeHdPelJ-UH4';
      var token = 'T1==cGFydG5lcl9pZD00NTU0NDUxMiZzaWc9OTk5NjU3YzI5ODIxYmI1N2FmOGFiZmY0OTdiNTZhMGI4YjA4NzI3NTpyb2xlPXB1Ymxpc2hlciZzZXNzaW9uX2lkPTFfTVg0ME5UVTBORFV4TW41LU1UUTFPVGsxT0RRM09EY3dPSDU2T1c1T2NHTXJUVW9yUWxoTksxbHBSR2hRZUhkUGVsSi1VSDQmY3JlYXRlX3RpbWU9MTQ1OTk1ODQ4MiZub25jZT0wLjQyMDgwMTM4OTA4NjY2MzMmZXhwaXJlX3RpbWU9MTQ2MjU1MDQ1MiZjb25uZWN0aW9uX2RhdGE9MQ===';
      var session = OT.initSession(apiKey, sessionId);
      session.on({
          streamCreated: function(event) {
            session.subscribe(event.stream, 'subscribersDiv', {insertMode: 'append'});
          }
      });
      session.connect(token, function(error) {
        if (error) {
          console.log(error.message);
        } else {
          session.publish('myPublisherDiv', {width: 640, height: 480});
        }
      });
    </script>
  </body>
</html>
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
That's all client-side JavaScript interacting with a third-party service via third-party-sourced files. The only things that can potentially be a hosting-related problem are (1) the HTML containing the JS is munged, which you can check for using view->source or your browser's developer tools, or (2) the protocol-relative URL, in the case that Tokbox actually requires HTTPS, which is unavailable of Free Hosting.

Dev Tools will tell you more about what's going on (the nature of the errors), such as whether all of the required scripts have loaded (JS often loads more JS), if something's blocking, and so forth. Check the loading timeline as well as the console. It may be that Tokbox doesn't like that API key with your domain as a HTTP_REFERER, but you won't know where the problem is without checking the console.
 
Status
Not open for further replies.
Top