2

I'm testing Twilio video on javascript to start a video call to either another javascript client or a mobile client. The javascript client is running in chrome with a server written in Java. There's no node.js runtime. I'm following the twilio video quickstarts but they all talk about npm and I see errors in my browser console about

ReferenceError: require is not defined

cause by

const { connect } = require('twilio-video');

Is the twilio-video SDK only compatible with nodejs or is it just the tutorials? is there a way to have a java backend that will allow to start video calls from a javascript client (browser) to another?

Hilikus
  • 9,954
  • 14
  • 65
  • 118

1 Answers1

1

From the quickstart on the Twilio website:

You can install the JavaScript Video library using NPM or Bower. You can also include it in your application using our CDN.

So no, you don't need to use Node.js.

That said, lots of modern JavaScript applications use tools that depend on Node.js as part of their build system. It is worth learning.

Note that using Node.js as part of the build system does not require a server written using Node.js in the production environment.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Is there any documentation for using plain JS? I dont get it how to connect as require('twilio-video'); will fail using regular JS – Manza Oct 20 '20 at 01:31
  • I got this to work by removing `require('twilio-video')` and instead used `const Video = Twilio.Video`. Just make sure twilio-video.js is enqueued before. Then you can do things like `Video.connect(...)` – Matt Mintun Nov 18 '20 at 01:27