Skip to content
This repository has been archived by the owner on Feb 28, 2019. It is now read-only.

Simple client for communication with Kurento server.

License

Notifications You must be signed in to change notification settings

Gruveo/kurento-simple-client-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Node Client for Kurento Server

Stability: EXPERIMENTAL

This is lightweight alternative client to https://github.com/Kurento/kurento-client-js.

Functions

  • kurento(url, callback, reporter) - callback(err, client), reporter(message)
  • client.create(objectType, constructorParams, callback) - callback(err, objectId)
  • client.invoke(objectId, operation, operationParams, callback) - callback(err, returnValue)
  • client.release(objectId, callback) - callback(err)
  • client.ping(interval, callback) - callback(err, pong)
  • client.subscribe(objectId, eventType, eventHandler, callback) - eventHandler(eventData), callback(err, subscriptionId)
  • client.unsubscribe(subscriptionId, objectId, callback) - callback(err)
  • client.getSessionId()
  • client.setSessionId(sessionId)
  • client.close()

Usage

Simple unfinished example:

const kurento = require('kurento-simple-client-js');
const autoInject = require('async/autoInject');
const each = require('async/each');
const config = require('config');

autoInject({
  client(cb) {
    kurento(config.get('mediaserver.kurento.url'), cb, function (message) {
      console.log(`Kurento Client: ${message}`);
    });      
  },

  mediaPipeline(client, cb) {
    client.create('MediaPipeline', cb);
  },

  webRtcEndpoint(client, mediaPipeline, cb) {
    client.create('WebRtcEndpoint', { mediaPipeline }, cb);
  },

  subscribeForIce(client, webRtcEndpoint, cb) {
    client.subscribe(webRtcEndpoint, 'OnIceCandidate', function ({ candidate }) {
      // send candidate to client
    }, cb);
  },

  addIceCandidates(client, webRtcEndpoint, cb) {
    each(candidates, function (candidate, cb) {
      client.invoke(webRtcEndpoint, 'addIceCandidate', { candidate }, cb);  
    }, cb);
  },

  // ...
}, function (err, results) {
  if (err) {
    log.error(err);

    if (results.client && results.mediaPipeline) {
      results.client.release(mediaPipeline, function (err) {
        if (err) {
          log.error(err);
        }
      });
    }
  }
});

About

Simple client for communication with Kurento server.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published