eyeson-team / android-sdk

Android SDK for eyeson video service incl. demo app
MIT License
3 stars 0 forks source link
android android-library kotlin webrtc

Eyeson Android SDK

Documentation for the Android SDK

Prerequisites

A webservice to host and maintain Eyeson meetings is required. The Eyeson Android SDK acts as communication client for a valid meeting room accessKey or guestToken. The respective keys can be obtained in exchange for an API key. See API documentation at Eyeson developers.

Installation

Add JitPack to your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Add the dependency to your app-level build.gradle. Latest version:

dependencies {
    implementation 'com.github.eyeson-team:android-sdk:VERSION'
}

Usage

Check out the documentation for more detailed information about usage, events and references.

The following section shows the basic steps to join a meeting. Take a look at the sample app for the full implementation. Compose sample and Basic View sample

Permissions

The Eyeson Android SDK uses the following permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

Add them to your manifest and make sure that you have requested the CAMERA and RECORD_AUDIO runtime permission before joining a meeting.

Crate meeting instance

val eyesonMeeting = EyesonMeeting(eventListener, application)

View

<com.eyeson.sdk.webrtc.VideoRenderer
    android:id="@+id/remoteVideo"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

<com.eyeson.sdk.webrtc.VideoRenderer
    android:id="@+id/localVideo"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

eglBaseContext can be obtained through the eyesonMeeting instance

localVideo.init(viewModel.getEglContext())
localVideo.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT)

remoteVideo.init(viewModel.getEglContext())
remoteVideo.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT)

Views must be released after the meeting has ended or terminated.

localVideo.release()
remoteVideo.release()

Join meeting

eyesonMeeting.join(
    accessKey = accessKey,
    frontCamera = true,
    audioOnly = false,
    local = localVideo,
    remote = remoteVideo
)