Skip to content

Latest commit

 

History

History
175 lines (137 loc) · 4.28 KB

README_bower.md

File metadata and controls

175 lines (137 loc) · 4.28 KB

Copyright © 2014 Kurento. Licensed under LGPL License.

JavaScript Kurento Client for Bower

The project contains the implementation of the JavaScript Kurento Client for Bower.

The source code of this project can be cloned from the GitHub repository.

Installation instructions

Be sure to have installed Node.js and Bower in your system:

curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
sudo npm install -g bower

To install the library, it's recommended to do that from the Bower repository :

bower install kurento-client

Alternatively, you can download the code using git and install manually its dependencies:

git clone https://github.com/Kurento/kurento-client-bower
cd kurento-client-bower
bower install

How to create a basic pipeline

For tutorial purposes, we are going to create a basic pipeline that play a video file from its URL and stream it over HTTP :

  1. Create an instance of the KurentoClient class that will manage the connection with the Kurento Media Server, so you'll need to provide the URI of its WebSocket endpoint. Alternatively, instead of using a constructor, you can also provide success and error callbacks:

    var kurento = kurentoClient.KurentoClient(ws_uri);
    
    kurento.then(function(kurento)
    {
      // Connection success
      
    },
    function(error)
    {
      // Connection error
      
    });
    kurentoClient.KurentoClient(ws_uri, function(kurento)
    {
      // Connection success
      
    },
    function(error)
    {
      // Connection error
      
    });
  2. Create a pipeline. This will host and connect the diferent elements. In case of error, it will be notified on the error parameter of the callback, otherwise this will be null as it's common on Node.js style APIs:

    kurento.create('MediaPipeline', function(error, pipeline)
    {
      
    });
  3. Create the elements. The player need an object with the URL of the video, and we'll also subscribe to the 'EndOfStream' event of the HTTP stream:

    pipeline.create('PlayerEndpoint',
    {uri: "https://ci.kurento.com/video/small.webm"},
    function(error, player)
    {
      
    });
    
    pipeline.create('HttpGetEndpoint', function(error, httpGet)
    {
      httpGet.on('EndOfStream', function(event)
      {
        
      });
    
      
    });
  4. Connect the elements, so the media stream can flow between them:

    player.connect(httpGet, function(error, pipeline)
    {
      
    });
  5. Get the URL where the media stream will be available:

    httpGet.getUrl(function(error, url)
    {
      
    });
  6. Start the reproduction of the media:

    player.play(function(error)
    {
      
    });

Kurento

What is Kurento

Kurento provides an open platform for video processing and streaming based on standards.

This platform has several APIs and components which provide solutions to the requirements of multimedia content application developers. These include:

  • Kurento Media Server (KMS). A full featured media server providing the capability to create and manage dynamic multimedia pipelines.
  • Kurento Clients. Libraries to create applications with media capabilities. Kurento provides libraries for Java, browser JavaScript, and Node.js.

Downloads

To download binary releases of Kurento components visit http://kurento.org

Code for other Kurento projects can be found in the GitHub Kurento group.

News and Website

Information about Kurento can be found on our website. Follow us on Twitter @kurentoms.