Giter Club home page Giter Club logo

janus-java-sdk's Introduction

Janus SDK Quickstart

Janus SDK Client currently use WebSocket to connect Janus Gateway, To use it you must have Janus WebSocket URL.


How to use ?

This sdk use CompletableFuture for async tasks, for more information you can take a look to this tutorials :

1. Create JanusClient instance

var janusClient = new JanusWebSocketClient("ws://voice.kavenegar.com:8188/", new JanusEventListener() {});
janusClient.connect();

2. Create janus session

janusClient.create().thenAccept(session -> {
    logger.info("Session created , id : {}",session.getId());        
}).exceptionally(error -> {
    logger.error("Error in creating session {}",error));
    return null;
});

3. Attach a plugin into session

You can set opaque_id for accessing handle in session.

session.attach(JanusPluginType.AUDIO_BRIDGE,"OPAQUE_ID").thenAccept(handle -> {
    if(handle instanceof AudioBridgeHandle audioBridge){
        // It's audio brdige plugin instance you can call plugin requests
    }
}).exceptionally(error -> {
    logger.error("Error in attaching handle to session {}",error));
    return null;
});

For example after creating handle you can get handle by opaque_id like this :

var handle = (AudioBridgeHandle) session.mediaSession().getHandle(endpoint.getUsername()).get();

4. Execute plugin commands

handle.create(new AudioBridgeCreateRoomRequest(1012)).thenAccept(created -> {
    // room is created    
});

5. Configure Room

handle.configure(new AudioBridgeConfigureRequest(false, "OFFER_SDP")).thenAccept(answer -> {
    // answer is here
});

janus-java-sdk's People

Contributors

mohsenk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

unisolzp sohe1l

janus-java-sdk's Issues

OSS License?

Hello, is it possible to clarify what license this software falls under? We'd like to consider it but are unclear what license applies.

Would you have a problem with applying an MIT license? I'd be happy to open up a PR if that helps.

Problem with SDP offer

It seems like SDP offer doesn't work.
According to other samples it is supposed to be the publish message rather than the configure message.
Either way it seems like the message is not synchronized with Janus-Gateway documentation.

Working Example ?

Hi, excellent work on the SDK , i was wodering since there is now a stable webrtc lib , for java desktop, do you have a working example for a maybe video or audio plugin as a project to improve usability further?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.