Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

mohsenk/janus-java-sdk

Open more actions menu

Repository files navigation

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
});

About

Janus WebRTC Server Java SDK

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.