0

I am trying to setup Twilio Video on my server.

I have the PHP server running on my server. I can access that server in the iOS versions of the Twilio video starter app.

My question is, how I can edit the Twilio Javascript version so I can make it run on my server too?

I want the Javascript server to use the PHP server and to make the Javascript version accessible from a page on my domain.

I'm not sure how to change the Javascript version to use the PHP server that is already running and how to change the address that the Javascript version is at (instead of localhost:3000 to be domain.com/videochat).

Thanks in advance.

Noah H
  • 93
  • 2
  • 9

1 Answers1

0

Twilio developer evangelist here.

If you have a PHP server that is returning tokens for use with Twilio Video, then using it with the JavaScript Video quick start is fairly straightforward.

The quick start requests the token on this line:

$.getJSON('/token', function(data) {

Here you can change the /token path to whatever path it is using on your PHP server.

With the JavaScript quickstart, the files are built using browserify, so you will still need to follow the instructions to build the index.js from src into the public folder. You may want to set this up differently, depending on your PHP build process.

Otherwise, as long as you serve the quickstart JS from the same domain as your PHP token server, all you need to do is update where the code gets the token from.

Let me know if that helps.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • When I do this and visit my domain.com/videochat/browser//quickstart/public, I can see the UI but the text box to insert the room key is missing (along with the join button). I can see the log on the right, the camera view, and the button to preview the camera (that button works). Can you think of anything that would be causing this? I did run "npm install" after I changed the token path and then "npm start". – Noah H May 29 '18 at 20:17
  • The only error I receive in the debug console is "TypeError: Value is not a sequence". When I use the inspector, I can see that the room controls are in the HTML, they just aren't showing up. – Noah H May 31 '18 at 02:52
  • Cool, so we have an error! Where is it being thrown from? What is the code causing it? We can drill down to find out the root of this problem. – philnash May 31 '18 at 09:42
  • Here is a link to a screenshot of the issue shown in the developer console (https://drive.google.com/file/d/1SkiS0S5dUdIVy-qL7JCyYsKCi1bDs1p4/view?usp=sharing). It appears that it points the error to:
    .
    – Noah H May 31 '18 at 15:39
  • Can you share the code from around where that gets called? What have you changed? – philnash Jun 04 '18 at 20:37
  • The website domain where the browser version is located is http://livehelp.ftchelp.org/live-test-server/browsr/quickstart/public/ . This might be easier than having me copy the changed code and the errors. – Noah H Jun 07 '18 at 00:34
  • Have you tried logging or debugging the code as it runs to see what is happening? It looks like the token is being fetched, but it's hard to see what's happening after that. – philnash Jun 07 '18 at 10:04