Fork me on GitHub

Client API

JavaScript library that will be used within your web applications.

You will use this API to handle connections to rooms and streams in your web applications.

This API is designed to be executed in the browsers of your users, so it is provided as a JavaScript file you can reference in your web applications.

Typical usage consists of: connection to the desired room, using the token retreived in the backend (explained at Server API), management of local audio and video, client event handling, and so on.

Here you can see the main classes of the library:

List of classes in Client API
Class Description
Erizo.Stream Provides access to local and remote video, audio and data streams in a Licode Room.
Erizo.Room Represents a Licode Room and provides connection, local stream publication and remote stream subscription.
Erizo.Events A set of different event types that represents a generic Event in the library.

It will handle the WebRTC (audio, video and/or data) stream, identify it, and where it should be drawn.

They could be local or remote. Licode internally creates remote streams through the Erizo.Room APIs.

It will identify each local and remote streams with stream.getID() and it controls where it should be drawn in the HTML page according to stream.play() (just in case they are video/audio streams).

You need to initialize the Stream before you can use it in the Room. Typical initializacion of Stream is:

 var stream = Erizo.Stream({audio:true, video:false, data: true, attributes: {name:'myStream'}});

audio, video and data variables has to be set to true if you want to publish them in the room. While attributes variable can store additional information related to the stream. This information will be shared between clients in the room.

If you want to use a stream to share your screen you should initialize it this way:

 var stream = Erizo.Stream({screen: true, data: true, attributes: {name:'myStream'}});

Note that, if you use a Stream this way, the client that will share its sreen must access to your web app using a secure connection (with https protocol) and use a screensharing plugin as explained here.

You can also specify some constraints about the video size when creating a stream. In order to do this you need to include a videoSize parameter that is an array with the following format: [minWidth, minHeight, maxWidth, maxHeight]

 var stream = Erizo.Stream({video: true, audio: true, videoSize: [320, 240, 640, 480]});

Also, you can create a stream to publish an external source to the Licode session. At this point, RTSP and files are supported, depending on the Codec (only H.264 for RTSP and VP8 + (OPUS or PCMU8) for files. You can create an external stream by using the url variable. These streams can be then published just as if they were a local stream.

For instance, to create a stream from a rtsp source:

 var stream = Erizo.Stream({video: true, audio: false, url:"rtsp://user:pass@the_server_url:port"});

Or, to create a stream from a .mkv file:

 var stream = Erizo.Stream({video: true, audio: false, url:"file:///path_to_file/movie.mkv"});

You can access the next variables in a stream object:

  • stream.showing to check whether the stream is locally playing our video/audio.
  • stream.room to know with which room it is connected.
  • stream.local to know if the given stream is local or remote.

In the next table we can see the functions of this class:

List of functions in Stream
Function Description
hasAudio() Indicates if the stream has audio activated.
hasVideo() Indicates if the stream has video activated.
hasData() Indicates if the stream has data activated.
init() Initializes the local stream.
close() Closes the local stream.
play(elementID, options) Draws the video or starts playing the audio in the HTML.
stop() Removes the video from the HTML.
muteAudio(isMuted, callback) Mutes the audio track of a remote stream.
sendData(msg) It sends data through the Stream to clients that are subscribed.
getAttributes() Gets the attributes variable stored when you created the stream.
setAttributes() It sets new attributes to the local stream that are spread to the room.
getVideoFrame() It gets a Bitmap from the video.
getVideoFrameURL() It gets the URL of a Bitmap from the video.
updateConfiguration(config, callback) Updates the spec of a stream

Check if the stream has audio, video and/or data active

You can check if the stream has audio, video and/or data activated by these functions.

The function in line 1 checks the audio while the function in line 2 checks the video and the function in line 3 checks the data.
stream.hasAudio();
stream.hasVideo();
stream.hasData();

Initialize the Stream

It initializes the stream and tries to retrieve a stream from local video and audio (in case you've activated them).

You need to call this method before you can publish the stream in the room or play it locally.

When you first create the stream, you need to initialize it (line 1). Then you need to add an event listener to know when the user has granted access to the webcam and/or microphone (line 2). You will receive an access-accepted or and access-denied event.
stream.init();
stream.addEventListener('access-accepted', function(event) {
  console.log("Access to webcam and/or microphone granted");
});
stream.addEventListener('access-denied', function(event) {
  console.log("Access to webcam and/or microphone rejected");
});

Close a local stream

It closes a local stream.

If the stream has audio and/or video this method also stops the capture of your camera and microphone.

If the stream is published in a room this method also unpublish it.

If the stream is playing in a div this method also stops it.

You can close a local stream previously initialized with this code.
stream.close();

Play a local stream in the HTML

It starts playing the video/audio at once at the given elementID. It automatically creates an audio/video HTML tag.

You can play the video/audio only when you have already received the access-accepted event. And you need to pass the elementID as argument. You can optionally hide the volume slider with the options argument.
stream.play(elementID, {speaker: false});
By default video streams are automatically adapted to the div that contains them. But it sometimes implies that the video will be croped. If you don't want to crop the video you can do like this:
stream.play(elementID, {crop: false});

Remove the local stream from the HTML

It stops playing the video/audio.

You can stop to play the video/audio in the HTML with this code.
stream.stop();

Mute the audio track of a remote stream

It stops receiving audio from a remote stream. The publisher of the stream will keep sending audio information to Licode but this particular subscriber won't receive it.

Note: it won't work on local streams, in p2p rooms or when the stream does not have an audio track.

You can mute the audio track (and stop receiving audio bytes) from the remote stream.
stream.muteAudio(true, function (result) {
  if (result === 'error') {
    console.log("There was an error muting the steram")
  }
});
You can also unmute the audio track.
stream.muteAudio(false, function (result) {
  if (result === 'error') {
    console.log("There was an error unmuting the steram")
  }
});

Send Data through the stream

It sends a message through this stream. All users that are already subscribed to it will received the message.

The client can send any JSON serializable message through this function, and it will be received through a stream-data event sent from the stream. So all clients should be previously subscribed to this stream.
stream.sendData({text:'Hello', timestamp:12321312});

Get the attributes object

Gets the attributes object that the user stored or updated in the stream.

The attributes variable is usually a JSON object.
var stream = Erizo.Stream({audio:true, video:false, data: true, attributes: {name:'myStream', type:'public'}});

var attributes = stream.getAttributes();
if(attributes.type === 'public') {
  console.log(attributes.name);
}
stream.addEventListener("stream-attributes-update", function(evt) {
  var stream = evt.stream;
  // Handle stream attribute event.
});

Set the attributes object

Updates attributes object in the stream. It can only be used in local streams and the changes will be propagated to the users who are subscribed to such stream. Other users will be notified through a special event called stream-attributes-update.

The attributes variable is usually a JSON object.
var stream = Erizo.Stream({audio:true, video:false, data: true, attributes: {name:'myStream', type:'public'}});

var attributes = stream.setAttributes({name: 'myStreamUpdated', type: 'private'});

Get a frame from the video

It gets an image frame from the video.

The client can get the bitmap raw data from the video streams. The Stream returns the Bitmap data. You can put it in a canvas element. If you want to get the image periodically you can set an interval.
var bitmap;
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');

canvas.id = "testCanvas";
document.body.appendChild(canvas);

setInterval(function() {

  bitmap = stream.getVideoFrame();

  canvas.width = bitmap.width;
  canvas.height = bitmap.height;

  context.putImageData(bitmap, 0, 0);

}, 100);

Get the URL of a frame from the video

It gets the URL of an image frame from the video.

Update the spec of a stream

It updates the audio and video maximum bandwidth for a publisher.

It can also be used in remote streams to toggle slideShowMode

You can update the maximun bandwidth of video and audio. These values are defined in the object passed to the function. You can also pass a callback function to get the final result.
var config = {maxVideoBW: 300, maxAudioBW: 300};

localstream.updateConfiguration(config, function(result) {
  console.log(result);
});

// We can update options also on a remote stream

remoteStream.updateConfiguration({slideShowMode:true}, function (result){
console.log(result);
});

It represents a Licode Room. It will handle the connection, local stream publication and remote stream subscription.

Typical Room initialization would be:

var room = Erizo.Room({token:'213h8012hwduahd-321ueiwqewq'});

It will create the room object by passing the token this users have previously received from your service. This token is has to be retreived using the Server API, because it is a user access token. But you need to call to the connect function we will see later in order to connect to the room.

You can access some variables like:

  • room.localStreams to retrieve the current list of local streams available in the room.
  • room.remoteStreams to retrieve the current list of remote streams available in the room.
  • room.roomID to know the identifier of this room.
  • room.state to access the current state of the room. States can be 0 if it is disconnected, 1 if it is connecting, and 2 if it is connected.

In the next table we can see the functions of this class:

List of functions in Room
Function Description
connect() It stablishes a connection to the room.
publish(stream) It publishes the stream.
subscribe(stream) It subscribes to a remote stream.
unsubscribe(stream) It unsubscribes from the stream.
unpublish(stream) It unpublishes the local stream.
disconnect() It disconnects from the room.
startRecording(stream) Starts recording the stream.
stopRecording(recordingId) Stops a recording identified by its recordingId.
getSreamsByAttribute(name, value) It returns a list of the remote streams that have the attribute specified by name - value strings.

Open a connection to Room

It establishes a connection to the room. This function is asynchronous so we need to add an event listener to know when we are finally connected to the room. It will throw a room-connected event when it occurs.

The room has to be previously created with a valid token. Then we connect to the room (line 1), and we add an event listener to wait for the connection to be established (line 2).

Please, take into account that you can't do anything else with the room until you have received this event!!.

room.connect();
room.addEventListener("room-connected", function(event) {
  console.log("Connected!");
});

Publish the local stream

It publishes the local stream given by an argument called stream.

Your client should be connected to the room and the stream should be first initialized.

When you call this function it starts to send video or audio to your Licode Room. Once the stream is ready all clients in the room will receive a stream-added event with the information about your stream and they could subscribe to it.

For publishing you first need to create and initialize a stream and connect to the room. Then you give the stream to the room in order to publish the streams it handles (line 1).

It throws a stream-added Event when the stream is finally published in the room, beacuse it will be added. So you have to add and event listener to handle it (line 2), and then check if the stream is the one you have just published (line 3).

room.publish(localStream);
room.addEventListener("stream-added", function(event) {
  if (localStream.getID() === event.stream.getID()) {
    console.log("Published!!!");
  }
});

room.publish also allows to set a bandwidth limit for the localStream. We do this by passing the maxVideoBW variable as an option. The BW is expressed in Kbps. Keep in mind that the field config.erizoController.defaultVideoBW in the server configuration has higher priority than this one.

room.publish(localStream, {maxVideoBW:300});

In room.publish you can include a callback with two parameters, id and error. If the stream has been published, id contains the id of that stream. On the other hand, if there has been any kind of error, id is undefined and the error is described in error.

Using the callback to catch possible problems
room.publish(localStream, {maxVideoBW:300}, function(id, error){
  if (id === undefined){
    console.log("Error publishing stream", error);
  } else {
    console.log("Published stream", id);
  }
});            

Subscribe to a remote stream

It subscribes to a remote stream in the room.

For subscribing to a stream you first need to connect to the room and know which streams are available in the room. So as we have already seen we first need to add an event listener to receive stream-added events.

In this case you will need an object of the Stream class, that we receive with that event.

You first need to connect to a room, and receive an event with the stream you want to subscribe.

NOTE: You can subscribe to the stream you are publishing, but you will receive it with delay. We recommend you to use the Stream API to play directly your local streams.

room.addEventListener("stream-subscribed", function(streamEvt) {
  console.log("Stream subscribed");
});
room.subscribe(stream);

You can choose which components (audio/video) of the stream you want to subscribe to using the second parameter of subscribe method.

Here we are going to subscribe to the audio but not to the video.
room.addEventListener("stream-subscribed", function(streamEvt) {
  console.log("Stream subscribed");
});
room.subscribe(stream, {audio: true, video: false});

In room.subscribe you can include a callback with two parameters, result and error. If the stream has been subscribed, result is true. On the other hand, if there has been any kind of error, result is undefined and the error is described in error.

Using the callback to catch possible problems
room.subscribe(stream, {audio: true, video: false}, function(result, error){
  if (result === undefined){
    console.log("Error subscribing to stream", error);
  } else {
    console.log("Stream subscribed!");
  }
});

When subscribing you can also configure the receiver to receive a lower bitrate Video stream from the publisher. We call this feature slideShowMode. By enabling it, this subscriber will receive one frame every two seconds from the publisher and won't affect the quality of other subscribers.

room.subscribe(stream, {audio: true, video: true, slideShowMode:true}, function(result, error){
  if (result === undefined){
    console.log("Error subscribing to stream", error);
  } else {
    console.log("Stream subscribed!");
  }
});

SlideShowMode can also be toggled on or off using stream.updateConfiguration. Keep in mind this will only work on remote streams (subscriptions).

Unsubscribe from a remote stream

You can unsubscribe from a stream you are currently subscribed.

Here apply the same requirements seen in the subscription.

You first need to be subscribed to the stream. When you unsubscribe from a stream the HTML element will be empty.
room.unsubscribe(stream);

In room.unsubscribe you can include a callback with two parameters, result and error. If the stream has been unsubscribed, result is true. On the other hand, if there has been any kind of error, result is undefined and the error is described in error.

Using the callback to catch possible problems
room.unsubscribe(stream, function(result, error){
  if (result === undefined){
    console.log("Error unsubscribing", error);
  } else {
    console.log("Stream unsubscribed!");
  }
});

Unpublish a local stream

You can unpublish your stream given in stream when your are connected to a room and you are currently publishing it.

Here apply the same requirements seen in the publish function.

The room will throw a stream-removed event to all the users when your streams are not published.

You first need to be publishing the local stream. Then you can unpublish your streams at any time (line 1). You can be sure your streams are not published when you receive a stream-removed event (lines 2-3).
room.unpublish(localStream);
room.addEventListener("stream-removed", function(event) {
  if (localStream.getID() === event.stream.getID()) {
    console.log("Unpublished!!!");
  }
});

In room.unpublish you can include a callback with two parameters, result and error. If the stream has been unpublished, result is true. On the other hand, if there has been any kind of error, result is undefined and the error is described in error.

Using the callback to catch possible problems
room.unpublish(localStream, function(result, error){
  if (result === undefined){
    console.log("Error unpublishing", error);
  } else {
    console.log("Stream unpublished!");
  }
});

Disconnect from Room

You can disconnect from the room when you want.

The room will throw a room-disconnected event.

You can disconnect from the room whenever you are previously connected.
room.disconnect();

Managing Quality Adaptation

By default, Licode will try to adapt the video quality of each publisher to the worst subscriber, that way, we ensure that all participants can partake in the conference. However, that means that video quality can be degraded for all the participants in a room if just one of them does not have enough bandwidth available.

To solve this, Licode gives you a flexible way to configure the behaviour of the adaptation per publisher. You specify a minVideoBW when you publish a stream. This will set the minimum video bitrate, you can use this when you want to control the minimum video quality for a given stream. On the subscriber, an estimate of the available bandwidth is calculated for a particular stream. Licode will react to a subscriber that is under the minVideoBW set by the publisher, based on the specified adaptation scheme. If no scheme is specified, Licode will only notify subscribers via a streamEvent.

room.publish(localStream, {maxVideoBW:2000, minVideoBW: 1000});

Schemes

An adaptation scheme is a behaviour patter that Licode will use on the subscribers that report having less available bandwidth than what was configured via minVideoBW.

Currently Licode implements three different adaptations schemes, one built on top of the other.

  • notify: Licode will only notify periodically subscribers that are belowminVideoBW. The possible messages, included in streamEvent.msg are:
    • insufficient: Indicates the subscriber is not reporting enough bandwidth
  • notify-break: Licode will notify subscribers, stop adapting the publisher to problematic subscribers and relegate them to audio-only mode. The possible messages, included in streamEvent.msg are:
    • insufficient: Indicates the subscriber is not reporting enough bandwidth
    • audio-only: Licode will now send only audio to this subscriber and the publisher will not try to adapt Video quality.
  • notify-break-recover: Same as notify-break but Licode will periodically try to recover the subscriber's video.The possible messages, included in streamEvent.msg are:
    • insufficient: Indicates the subscriber is not reporting enough bandwidth, Licode will stop sending Video to this subscriber and the publisher won't try to adapt.
    • recovered: This stream has successfully recovered, reports more that minVideoBW and Licode will treat it as a stream with no bandwidth problems
    • audio-only: Licode will stop trying to recover and send only audio to this subscriber and the publisher will not try to adapt Video quality.

You will have to set your desired scheme per publisher:

room.publish(localStream, {maxVideoBW:2000, minVideoBW: 1000 scheme:"notify-break"});

The default scheme is notify.

Licode uses streamEvents to notify clients, so you will need to listen to the following events to properly take advantage of the schemes in your application. These events are:

  • notify: Licode will only notify periodically subscribers that are belowminVideoBW.
  • notify-break: Licode will notify subscribers, stop adapting the publisher to problematic subscribers and relegate them to audio-only mode.
  • notify-break-recover: Same as notify-break but Licode will periodically try to recover the subscriber's video.

Keep in mind you can use this in combination with SlideShowMode allowing for a wide variety of configurations.

Start Recording

Start the recording of a stream in the server in the path specified in licode_config.js

The recording will stored in a .mkv file using VP8 codec for video and PCMU or OPUS for audio, depending on the server configuration. This file can be played directly or streamed into a Licode room.

Licode will keep recording until stopRecording is called or the stream is removed from the room.

Start the recording of the local stream.
room.startRecording(localStream, function(recordingId, error) {
  if (recordingId === undefined){
    console.log("Error", error);
  } else {
    console.log("Recording started, the id of the recording is ", recordingId);
  }
});          

Stop Recording

Stop the recording of a stream. You must provide the identificator of the recording: recordingId.

Stop the recording.
room.stopRecording(recordingId, function(result, error){
  if (result === undefined){
    console.log("Error", error);
  } else {
    console.log("Stopped recording!");
  }
});

Playing recorded streams

There are two ways of playing a recorded stream. Both of them involve the creation of an external stream. You can either set the url variable to the path of the recorded file or use the recordingId as a variable.

Play a recording from full path (url) or by using its recordingId.
var stream = Erizo.Stream({video: true, audio: false, url:"file:///path_to_file/previousRecording.mkv"});
room.publish(stream);
var stream2 = Erizo.Stream({audio:true, video:true, recording: 'asda2131231'});
room.publish(stream2);

Get Streams by attribute

You can search remote streams by attribute. A remote stream is a room stream you have previously subscribed to.

If you want to get the streams of type 'public':
var streams = room.getStreamsByAttribute('type', 'public');
//streams is an array that contains the stream objects.

Event Handling

Room inherits EventDispatcher (see events for further information), for handling RoomEvents and StreamEvents. For example:

  • Event 'room-connected' points out that the user has been successfully connected to the room.
  • Event 'room-error' indicates that there has been an error and it hasn't been possible to connect to the room.
  • Event 'room-disconnected' shows that the user has been already disconnected.
  • Event 'stream-added' indicates that there is a new stream available in the room.
  • Event 'stream-removed' shows that a previous available stream has been removed from the room.

The client could receive any event when it is connected.

Despite we have shown examples of event listeners during the documentation, we strongly recommend to add event listeners before you do any action in the room. The previous examples only illustrated the behaviour of Room's functions.
var room = Room({token:"..."});
room.addEventListener("room-connected", function(evt){...});
room.addEventListener("room-error", function(evt){...});
room.addEventListener("room-disconnected", function(evt){...});
room.addEventListener("stream-added", function(evt){...});
room.addEventListener("stream-removed", function(evt){...});
room.connect();

Licode provides a set of event classes to handle changes during client connection.

Room and Stream classes throw different Licode events (they are EventDispatchers) and it's always a good idea to listen to them. Here we will explain the different kinds of events in Licode. In the next table you can see a brief description.

List of Event classes
Class Description
licode Event It represents a generic Event in the library, which is inherited by the others.
Room Event It represents an events related to Room connection.
Stream Event It represents an event related to streams within a room.

Licode Event

It handles the type of event, that is important when adding event listeners to EventDispatchers and dispatching new events.

A LicodeEvent can be initialized like this, but it is usually created by Client API.
var event = Erizo.LicodeEvent({type: "room-connected"});

Room Event

It represents connect and disconnect events.

You can access the list of streams connected to the room by accessing roomEvent.streams.

These are the type of Room events thrown:

  • room-connected: points out that the user has been successfully connected to the room. This message also provides the list of streams that are currently published in the room.
  • room-error: indicates that it hasn't been possible a succesufully connection to the room.
  • room-disconnected: shows that the user has been already disconnected.

They are all dispatched by Room objects

A RoomEvent can be initialized like this, but it is usually created by Room objects.
var roomEvent = Erizo.RoomEvent({type:"room-connected", streams:[stream1, stream2]});
They all are dispatched by Room objects, so you need to add event listeners to them.
room.addEventListener("room-connected", function(evt){...});

Stream Event

It represents an event related to a stream.

You can access the related stream by streamEvent.stream.

Some of them have a more detailed message in streamEvent.msg.

There are the different types of Stream events:

  • access-accepted: indicates that the user has accepted to share his camera and microphone.
  • access-denied: indicates that the user has denied to share his camera and microphone.
  • stream-added: indicates that there is a new stream available in the room.
  • stream-removed: shows that a previous available stream has been removed from the room.
  • stream-data: thrown by the stream it indicates new data received in the stream.
  • stream-attributes-update: notifies when the owner of the given stream updates its attributes
  • bandwidth-alert: thrown when a subscriber stream is reporting less than the minVideoBW specified in the publisher. The event has three parts:
    • streamEvent.stream is the problematic subscribe stream.
    • streamEvent.bandwidth is the available bandwidth reported by that stream.
    • streamEvent.msg the status of that stream, depends on the adaptation scheme.
  • stream-failed: A stream has failed, either in the connection establishment or during the communication.

They all are dispatched by Room objects.

A StreamEvent can be initialized like this, but it is usually created by Client API.
var streamEvent = Erizo.StreamEvent({type:"stream-added", stream:stream1});
stream-added, stream-removed and stream-failed are dispatched by Room objects, so you need to add event listeners to them.
room.addEventListener("stream-removed", function(evt){...});
access-accepted, access-denied, stream-data, stream-attributes-update and bandwidth-alert are dispatched by Stream objects, so you need to add event listeners to them.
stream.addEventListener("access-accepted", function(evt){...});

stream.addEventListener("stream-data", function(evt){
  console.log('Received data ', evt.msg, 'from stream ', evt.stream.getAttributes().name);
});

room.addEventListener("stream-attributes-update", function(evt){...});

Here we show some examples and code snippets for typical use cases in this API.

In this section we will see a set of examples to use almost every part of this API.

Basic Videoconference

In this example we will make a basic videoconference application. Every client than connects to the application will publish his video and audio and will subscribe to all the videos and audios of the other clients. This example uses an unique room.

<html>
  <head>
    <title>Licode Basic Example</title>
    <script type="text/javascript" src="erizo.js"></script>
    <script type="text/javascript">

      window.onload = function () {

          var localStream = Erizo.Stream({audio: true, video: true, data: true});
          var room = Erizo.Room({token: "af54/=gopknosdvmgiufhgadf=="});

          localStream.addEventListener("access-accepted", function () {

              var subscribeToStreams = function (streams) {
                  for (var index in streams) {
                    var stream = streams[index];
                    if (localStream.getID() !== stream.getID()) {
                        room.subscribe(stream);
                    }
                  }
              };

              room.addEventListener("room-connected", function (roomEvent) {

                  room.publish(localStream);
                  subscribeToStreams(roomEvent.streams);
              });

              room.addEventListener("stream-subscribed", function(streamEvent) {
                  var stream = streamEvent.stream;
                  var div = document.createElement('div');
                  div.setAttribute("style", "width: 320px; height: 240px;");
                  div.setAttribute("id", "test" + stream.getID());

                  document.body.appendChild(div);
                  stream.play("test" + stream.getID());
              });

              room.addEventListener("stream-added", function (streamEvent) {
                  var streams = [];
                  streams.push(streamEvent.stream);
                  subscribeToStreams(streams);
              });

              room.addEventListener("stream-removed", function (streamEvent) {
                  // Remove stream from DOM
                  var stream = streamEvent.stream;
                  if (stream.elementID !== undefined) {
                      var element = document.getElementById(stream.elementID);
                      document.body.removeChild(element);
                  }
              });

              room.connect();
              localStream.play("myVideo");
          });
          localStream.init();
      };
    </script>
  </head>

  <body>
    <div id="myVideo" style="width:320px; height: 240px;">
    </div>
  </body>
</html>

Running erizo clients in your node.js applications.

You can also run erizo clients in your node.js applications with the same API explained here. You can connect to rooms, publish and subscribe to streams and manage events. You need only to import the node module erizofc.js

var Erizo = require('.erizofc').Erizo;

And now you can use the API like explained for the browser case, calling Erizo.Room, Erizo.Stream and Erizo.Events. Note that you can not publish/subscribe streams with video and/or audio. We are working on this feature in order to develop another way of distribute video/audio streams.

You can also use Erizo Client Logger for managing log levels, etc

var L = require('.erizofc').L;
L.Logger.setLogLevel(2);

Head to the Server API for information, examples, and code snippets of the additional API to manage rooms, and give access to users, or start testing this API.

Visit the Server API Try it!