Giter Site home page Giter Site logo

voximplant / unity_sdk Goto Github PK

View Code? Open in Web Editor NEW
17.0 16.0 3.0 524.28 MB

Voximplant SDK for adding messaging, voice calling, video chat, and live streaming to Unity apps

License: MIT License

Objective-C 14.32% Objective-C++ 10.86% C# 38.43% Java 14.25% C 9.77% Ruby 0.17% C++ 11.43% GLSL 0.54% ShaderLab 0.21%
voximplant voip videochat client-sdk

unity_sdk's Introduction

Voximplant Unity SDK

Demo

https://github.com/voximplant/unity_sdk_demo

Install

  1. Download latest Voximplant Unity SDK from GitHub Releases
  2. In Unity Editor, select Assets > Import Package > Custom Package... Navigate to the directory where you downloaded the Voximplant Unity SDK and select VoximplantSDK-*.unitypackage.
  3. Import all assets in the package.

Usage

To get started, you'll need to register a free Voximplant developer account.

Initialization

IClient is the main class of the SDK that provides access to Voximplant’s functions, the VoximplantSdk.GetClient() method is used to get its instance:

VoximplantSdk.Initialize();
_client = VoximplantSdk.GetClient();

_client.Connected += ClientOnConnected;
_client.LoginSuccess += ClientOnLoginSuccess;

Connect and log in to the Voximplant Cloud

The IClient.State property is used to get the current state of connection to the Voximplant cloud and perform the actions according to it.

private void LoginWithPassword(string login, string password) {
    _login = login;
    _password = password;
    if (_client.State == ClientState.Disconnected)
    {
        _client.Connect();
    }
    else if (_client.State == ClientState.Connected)
    {
        _client.Login(_login, _password);
    }
}

private void ClientOnConnected(IClient sender)
{
    _client.Login(_login, _password);
}

private void ClientOnLoginSuccess(IClient sender, LoginSuccessEventArgs e)
{
    _displayName = e.DisplayName;
}

Make calls

To initiate a call we need the IClient.Call() method. There is a CallSettings class which could contain custom data and extra headers (SIP headers).

Since the call can behave in different ways, there is a group of call events. They can be triggered by the ICall instance as the class contains all the functionality for call management.

private ICall MakeAudioCall(string number)
{
    var call = _client.Call(number, new CallSettings());
    if (call == null) return null;

    call.Disconnected += OnCallDisconnected;
    call.Failed += OnCallFailed;
    call.Connected += OnCallConnected;
    call.Ringing += OnCallRinging;
    call.AudioStarted += OnCallAudioStarted;

    call.Start();
    return call;
}

private void OnCallConnected(ICall sender, CallConnectedEventArgs e)
{
    Debug.Log("Call connected");
}

Receiving calls

IClient.IncomingCall event handler is used to get incoming calls.

There are two methods for an incoming call: answer and reject. An audio stream can be sent only after the answer method call.

VoximplantSdk.GetClient().IncomingCall += OnIncomingCall;

private void OnIncomingCall(IClient sender, IncomingCallEventArgs e)
{
    sender.Answer(new CallSettings());
}

Mid-call operations

Call can be put on/off hold

_call.Hold(true, error =>
{
    if (error != null)
    {
        Debug.LogError(error.Value.Message);
    }
});

Limitations

  • Supported Unity versions 2020, 2019 (LTS) and 2018 (LTS)
  • Android Multithreaded and Vulkan rendering are unsupported
  • iOS OpenGL rendering is unsupported

unity_sdk's People

Contributors

grigoryvp avatar niveuseverto avatar s3ptikus avatar yuliagrigorieva avatar zintus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unity_sdk's Issues

iOS crash when receiving remote feed

When building from the most recent source, the app crashes immediately after OnCallConnected. I've tested with opengl, and with metal, and get the same result

Crash Log:
2018-04-05 17:43:26.193847-0700 voxdemo[866:224080] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RTCVideoFrame dataY]: unrecognized selector sent to instance 0x1c464a1a0'
*** First throw call stack:
(0x18543a364 0x184680528 0x185447828 0x18543fd10 0x185324ecc 0x103466da0 0x1034667d4 0x1853e2790 0x1853e2060 0x1853e02c8 0x1852ffe58 0x185d35594 0x103466198 0x185e370f4 0x1850602b4 0x185060180 0x18505eb74)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

AR Camera Support

Hi there,
Is there a way I can transfer my own texture that would be of my screen capture and not camera feed so that the objects can also be seen on the other end?

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.