How to use Licode

Hi All,

Our CTO asked me to install Licode so I did that.

The installation was successful according to documentation and it is running on localhost:3000 and when I tried to open this in browser then I got this.

{“WWW-Authenticate”:“MAuth realm=“http://marte3.dit.upm.es””}.

Now I just want to know how i can use this? how I can crate rooms and how my company user’s will connect with my server etc.

– Umar

Open link : your_IP:3001 not 3000

Hi Buzuaki,

Yes that I found, but again how I can use this? What I give to my users so they can start video conferencing etc.

This localhost:3001 only have

Toggle Recording, Test Connection button and Toggle Slide Mode buttons and nothing else.

See Licode’s documentation. There are two API’s one for back-end and another one for front-end.

if everything is right in this page you have to see request for your cam

check browser console for errors

Hi Prakhar

I tried server API from the following doc http://lynckia.com/licode/server-api.html

But that is not working and I am stuck there with this error.

var app = express.createServer();
^

TypeError: express.createServer is not a function
at Object. (/root/licode/extras/basic_example/myserver.js:8:19)
at Module._compile (module.js:570:32)
at Object.Module._extensions…js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3

you have to include the modules

var express = require(‘express’),
bodyParser = require(‘body-parser’),
errorhandler = require(‘errorhandler’),
morgan = require(‘morgan’),
N = require(’./nuve’),
fs = require(‘fs’),
https = require(‘https’),
config = require(’./…/…/licode_config’);

N.API.init(config.nuve.superserviceID, config.nuve.superserviceKey, ‘http://localhost:3000/’);

same Error here is my code

/global require, __dirname, console/
‘use strict’;

bodyParser = require(‘body-parser’),
errorhandler = require(‘errorhandler’),
morgan = require(‘morgan’),
N = require(’./nuve’),
fs = require(‘fs’),
https = require(‘https’),
config = require(’./…/…/licode_config’);

N.API.init(config.nuve.superserviceID, config.nuve.superserviceKey, ‘http://localhost:3000/’);

var express = require(‘express’),
var app = express.createServer();

app.use(express.bodyParser());
app.configure(function () {
app.use(express.logger());
app.use(express.static(__dirname + ‘/public’));
});

app.post(’/createRoom/’, function(req, res){

N.API.createRoom('myRoom', function(roomID) {
    res.send(roomID);
}, function (e) {
    console.log('Error: ', e);
});

});

app.get(’/getRooms/’, function(req, res){

N.API.getRooms(function(rooms) {
    res.send(rooms);
}, function (e) {
    console.log('Error: ', e);
});

});

app.get(’/getUsers/:room’, function(req, res){

var room = req.params.room;
N.API.getUsers(room, function(users) {
    res.send(users);
}, function (e) {
    console.log('Error: ', e);
});

});

app.post(’/createToken/:room’, function(req, res){

var room = req.params.room;
var username = req.body.username;
var role = req.body.role;
N.API.createToken(room, username, role, function(token) {
    res.send(token);
}, function (e) {
    console.log('Error: ', e);
});

});

app.listen (80);

run : netstat -tunlp

and verify that all services is running OR get the output here

Thank You.

You need to install express first and then require it in your code.
See express documentation here
https://expressjs.com

here is the output

ctive Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:28017 0.0.0.0:* LISTEN 1329/mongod
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 18778/0
tcp 0 0 0.0.0.0:39838 0.0.0.0:* LISTEN 1453/beam.smp
tcp 0 0 0.0.0.0:54558 0.0.0.0:* LISTEN 1356/sshd
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 1329/mongod
tcp6 0 0 :::4369 :::* LISTEN 1416/epmd
tcp6 0 0 :::3000 :::* LISTEN 2464/node
tcp6 0 0 ::1:6010 :::* LISTEN 18778/0
tcp6 0 0 :::54558 :::* LISTEN 1356/sshd
tcp6 0 0 :::5672 :::* LISTEN 1453/beam.smp
tcp6 0 0 :::8080 :::* LISTEN 2819/node

the express is already installed, the problem is something else.

The basicServer.js is running fine on 3001 which is shipped with licode, but the server-api example on their site is not working.

here’s my example it’s running locally to create / list rooms

var express = require(‘express’),
bodyParser = require(‘body-parser’),
errorhandler = require(‘errorhandler’),
morgan = require(‘morgan’),
N = require(’./nuve’),
fs = require(‘fs’),
https = require(‘https’),
config = require(’./…/…/licode_config’);

N.API.init(config.nuve.superserviceID, config.nuve.superserviceKey, ‘http://localhost:3000/’);

//Create new Room
var roomName = ‘myRedRoomNop2p’;
N.API.createRoom(roomName, function(room) {
console.log('not p2p room created with id: ', room._id);
}, {data: {room_color: ‘yellow’,
room_description: ‘Room for testing metadata’,
p2p: false,}});

//List All Rooms

N.API.getRooms(function(roomList) {
var rooms = JSON.parse(roomList);
for(var i in rooms) {
console.log('Room ', i, ‘:’, rooms[i]);
//console.log(‘RoomData’ , i , ‘:’, rooms[i].data);
}
});

//getRoom

var roomId = ‘5858ebff5996e46a190d6602’;

N.API.getRoom(roomId, function(resp) {
var room= JSON.parse(resp);
console.log('Room name: ', room.name);
});

var roomId = ‘5858ed055996e46a190d6605’;

N.API.deleteRoom(roomId, function(result) {
console.log('Result: ', result);
});

Well this is not the complete code, where is the app.listen things etc?

this only for cli to create and list rooms by running nodejs app.js RoomName … etc
once i complete the code using express i’ll post it here for you
Thank You

HI Buzaki

Thanks for your help, now finally app is running, i can browse

localhost/getRooms/
localhost/createRoom/

etc.

Now the question is what I give to my users so they can just open the my url and start their conferencing

in basic example dir there’s public/index.html ;

this page users can test the cam and voice it’s listening on port 3001

this page : Toggle Recording, Test Connection button and Toggle Slide Mode buttons and nothing else.

if you didn’t got any request from browser to open cam check the console to find errors

Thank You.

Hi Buzaki,

That is fine, you can access my server

http://67.205.163.231/

you can see the 3 buttons. I have 5 users (a,b,c,d,e) I want to crate them and then I will give the url to those users.

Now the question is how to create a user? and then what will be the url which I need to give my user so when they open that there they should see the room name and the users as well, so they can start chat and video sharing etc.

it’s not working for me because of SSL

getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.
Erizo.GetUserMedia @ erizo.js:140

about users … i’m still learning now how to do it from client-api :pensive:

Thank You.

Ok here is I have enabled ssl

https://scivoip1.scicloud.net/