Skip to content

Commit b536ccb

Browse files
committed
update to support sdk v1.1.1 and integrate new parameters in the demo app.
1 parent 524ba16 commit b536ccb

4 files changed

Lines changed: 238 additions & 99 deletions

File tree

README.md

Lines changed: 107 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,108 @@
11
# Auvious Android SDK Example
2-
This repo contains example of how to use AuviousSDK.
3-
4-
To use AuviousSDK in your project follow these steps:
5-
- Add `https://nexus.auvious.com/repository/maven-releases` nexus repository. If you are using gradle
6-
then your build.gradle repositories section should look something like this:
7-
```groovy
8-
repositories {
9-
mavenCentral()
10-
// ... other repositories
11-
// Auvious SDK Repo
12-
maven { url "https://nexus.auvious.com/repository/maven-releases" }
13-
}
14-
```
15-
- Include `com.auvious.android:sdk:1.0.15` dependency. Again if you are using Gradle, then your
16-
build.gradle dependencies section would look like this:
17-
```groovy
18-
dependencies {
19-
//... other dependencies
20-
21-
// Auvious SDK
22-
implementation 'com.auvious.android:sdk:1.0.15'
23-
}
24-
```
25-
26-
- Launch `AuviousSimpleConferenceActivity` to join a call with ticket like this:
27-
```kotlin
28-
val callOptions = AuviousSimpleConferenceOptions(
29-
"customer",
30-
"https://auvious.video",
31-
"wss://auvious.video/ws",
32-
mapOf(
33-
"ticket" to edit_ticket.text.toString(),
34-
"grant_type" to "password",
35-
"mic" to "true",
36-
"camera" to "true",
37-
"speaker" to "false"
38-
)
39-
)
40-
41-
val startForResult =
42-
registerForActivityResult(ActivityResultContracts.StartActivityForResult())
43-
{ result: ActivityResult ->
44-
if (result.resultCode != Activity.RESULT_OK) {
45-
// you will get result here in result.data
46-
result.data?.getParcelableExtra<AuviousSdkSimpleConferenceError>(
47-
AuviousSimpleConferenceActivity.getResultIntentName()
48-
)?.let {
49-
Toast.makeText(this, "Error code is ${it.errorCode}", Toast.LENGTH_LONG)
50-
.show()
51-
}
52-
}
53-
AuviousConferenceSDK.instance.onDestroy()
54-
}
55-
startForResult.launch(AuviousSimpleConferenceActivity.getIntent(this, callOptions))
56-
```
57-
Within the `mapOf()` configuration, there are three options for initializing the microphone, camera, and speaker for the call session. Here's how they work and how to adjust them:
58-
59-
**Microphone Configuration**
60-
- Key: `mic`
61-
- Value: `true` or `false`
62-
- `true`: This enables the microphone, allowing the user to send audio during the call.
63-
- `false`: This disables the microphone, so the user will not be able to send audio. However, they can still hear audio if the speaker is enabled.
64-
65-
**Camera Configuration**
66-
- Key: `camera`
67-
- Value: `true` or `false`
68-
- `true`: This enables the camera, allowing the user to send video during the call.
69-
- `false`: This disables the camera, so the user will not send video. However, they can still see the video from other participants.
70-
71-
**Speaker Configuration**
72-
- Key: `speaker`
73-
- Value: `true` or `false`
74-
- `true`: This enables the speaker, allowing the user to hear audio from other participants.
75-
- `false`: This disables the speaker, so the user will hear sound by device's earpiece.
2+
This repository contains an example of how to use the AuviousSDK in an Android project.
3+
4+
To use the AuviousSDK in your project, follow these steps:
5+
6+
## Setup Instructions
7+
8+
1. Add `https://nexus.auvious.com/repository/maven-releases` as a Nexus repository. If you're using Gradle, add this to your `build.gradle` repositories section:
9+
```groovy
10+
repositories {
11+
mavenCentral()
12+
// ... other repositories
13+
// Auvious SDK Repo
14+
maven { url "https://nexus.auvious.com/repository/maven-releases" }
15+
}
16+
```
17+
18+
2. Include the Auvious SDK dependency. Add this line to your `build.gradle` dependencies section:
19+
```groovy
20+
dependencies {
21+
//... other dependencies
22+
// Auvious SDK
23+
implementation 'com.auvious.android:sdk:1.1.1'
24+
}
25+
```
26+
27+
## Usage Example
28+
29+
To start a conference, use the `AuviousSimpleConferenceActivity` with configurable call options, such as microphone, camera, and speaker settings:
30+
31+
```kotlin
32+
private fun startSimpleConferenceActivity(
33+
enableMic: Boolean = true,
34+
enableCam: Boolean = true,
35+
enableEarPieceSpeaker: Boolean = false,
36+
availableMicButton: Boolean = true,
37+
availableCamButton: Boolean = true,
38+
availableSpeakerButton: Boolean = true,
39+
customConferenceBackgroundColor: Boolean = false
40+
) {
41+
val callOptions = AuviousSimpleConferenceOptions(
42+
"customer",
43+
"https://auvious.video",
44+
"wss://auvious.video/ws",
45+
mapOf(
46+
"ticket" to binding.ticketText.text.toString(),
47+
"grant_type" to "password",
48+
AuviousSimpleConferenceOptions.speakerOption to (!enableEarPieceSpeaker).toString(),
49+
AuviousSimpleConferenceOptions.microphoneOption to enableMic.toString(),
50+
AuviousSimpleConferenceOptions.cameraOption to enableCam.toString(),
51+
AuviousSimpleConferenceOptions.cameraAvailable to availableCamButton.toString(),
52+
AuviousSimpleConferenceOptions.microphoneAvailable to availableMicButton.toString(),
53+
AuviousSimpleConferenceOptions.speakerAvailable to availableSpeakerButton.toString(),
54+
AuviousSimpleConferenceOptions.conferenceBackgroundColor to if (customConferenceBackgroundColor) Color.parseColor("#3366ff").toString() else Color.BLACK.toString()
55+
)
56+
)
57+
activityForResult.launch(AuviousSimpleConferenceActivity.getIntent(this, callOptions))
58+
}
59+
```
60+
61+
### Option Descriptions
62+
63+
#### Enable default functionality
64+
- **Microphone Configuration**
65+
- **Key**: `mic`
66+
- **Value**: `true` or `false`
67+
- `true`: Enables the microphone.
68+
- `false`: Disables the microphone.
69+
70+
- **Camera Configuration**
71+
- **Key**: `camera`
72+
- **Value**: `true` or `false`
73+
- `true`: Enables the camera.
74+
- `false`: Disables the camera.
75+
76+
- **Speaker Configuration**
77+
- **Key**: `speaker`
78+
- **Value**: `true` or `false`
79+
- `true`: Enables the speaker.
80+
- `false`: Enables only the earpiece.
81+
82+
#### Available conference control buttons
83+
- **Microphone Button Availability**
84+
- **Key**: `mic_available`
85+
- **Value**: `true` or `false`
86+
- `true`: The microphone button will be available for toggling on/off.
87+
- `false`: The microphone button will be hidden.
88+
89+
- **Camera Button Availability**
90+
- **Key**: `camera_available`
91+
- **Value**: `true` or `false`
92+
- `true`: The camera button will be available for toggling on/off.
93+
- `false`: The camera button will be hidden.
94+
95+
- **Speaker Button Availability**
96+
- **Key**: `speaker_available`
97+
- **Value**: `true` or `false`
98+
- `true`: The speaker button will be available for toggling on/off.
99+
- `false`: The speaker button will be hidden.
100+
101+
- **Custom Conference Background Color**
102+
- **Key**: `conference_background_color`
103+
- **Value**: [Color](https://developer.android.com/reference/android/graphics/Color) object or a hex color by using the [Color.parseColor()](https://developer.android.com/reference/android/graphics/Color#parseColor(java.lang.String)) method
104+
- Set a custom color in conference background. Otherwise, the default background color will be black.
105+
106+
---
107+
108+
With these additional configurations, you have greater control over the UI and functionality within the [Auvious](www.auvious.com) conference experience, allowing you to fine-tune the behavior and appearance for your users.

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ android {
4040
dependencies {
4141
implementation fileTree(dir: 'libs', include: ['*.jar'])
4242
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
43-
implementation 'com.auvious.android:sdk:1.0.15'
43+
implementation 'com.auvious.android:sdk:1.1.1'
4444

4545
implementation 'androidx.appcompat:appcompat:1.7.0'
4646
implementation 'androidx.core:core-ktx:1.13.1'

app/src/main/java/com/auvious/auviousproject/MainActivity.kt

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ package com.auvious.auviousproject
33
import android.Manifest
44
import android.Manifest.permission.READ_MEDIA_IMAGES
55
import android.app.Activity
6-
import android.content.Intent
76
import android.content.pm.PackageManager
7+
import android.graphics.Color
88
import android.os.Build
99
import android.os.Bundle
10-
import android.os.Parcelable
1110
import android.widget.Toast
1211
import androidx.activity.result.ActivityResult
1312
import androidx.activity.result.contract.ActivityResultContracts
@@ -26,6 +25,9 @@ import com.microsoft.appcenter.analytics.Analytics
2625
import com.microsoft.appcenter.crashes.Crashes
2726
import kotlin.random.Random
2827

28+
/**
29+
* Created by BKarampinis on 13-Jul-20
30+
*/
2931
class MainActivity : AppCompatActivity() {
3032

3133
private lateinit var binding: ActivityMainBinding
@@ -60,6 +62,9 @@ class MainActivity : AppCompatActivity() {
6062
binding.requestCameraPerm.setOnClickListener { checkForCameraStoragePermission() }
6163
binding.requestMicPerm.setOnClickListener { checkForAudioRecordPermission() }
6264
binding.requestStoragePerm.setOnClickListener { checkForWriteStoragePermission() }
65+
/**
66+
* AuviousSimpleConferenceActivity example
67+
* */
6368
binding.joinCall.setOnClickListener {
6469
if (binding.ticketText.text.isNullOrEmpty()) {
6570
Toast.makeText(
@@ -76,27 +81,39 @@ class MainActivity : AppCompatActivity() {
7681
} else {
7782
startSimpleConferenceActivity(
7883
enableCam = !binding.micOnlySwitch.isChecked,
79-
enableSpeaker = binding.speakerSwitch.isChecked,
84+
enableEarPieceSpeaker = binding.speakerSwitch.isChecked,
85+
availableCamButton = binding.cameraAvailableSwitch.isChecked,
86+
availableMicButton = binding.micAvailableSwitch.isChecked,
87+
availableSpeakerButton = binding.speakerAvailableSwitch.isChecked,
88+
customConferenceBackgroundColor = binding.conferenceBackgroundSwitch.isChecked
8089
)
8190
}
8291
}
83-
8492
}
8593
private fun startSimpleConferenceActivity(
8694
enableMic: Boolean = true,
8795
enableCam: Boolean = true,
88-
enableSpeaker: Boolean = true
96+
enableEarPieceSpeaker: Boolean = false,
97+
availableMicButton: Boolean = true,
98+
availableCamButton: Boolean = true,
99+
availableSpeakerButton: Boolean = true,
100+
customConferenceBackgroundColor: Boolean = false
89101
) {
102+
90103
val callOptions = AuviousSimpleConferenceOptions(
91104
"customer",
92105
"https://auvious.video",
93106
"wss://auvious.video/ws",
94107
mapOf(
95108
"ticket" to binding.ticketText.text.toString(),
96109
"grant_type" to "password",
110+
AuviousSimpleConferenceOptions.speakerOption to (!enableEarPieceSpeaker).toString(),
97111
AuviousSimpleConferenceOptions.microphoneOption to enableMic.toString(),
98112
AuviousSimpleConferenceOptions.cameraOption to enableCam.toString(),
99-
AuviousSimpleConferenceOptions.speakerOption to enableSpeaker.toString()
113+
AuviousSimpleConferenceOptions.cameraAvailable to availableCamButton.toString(),
114+
AuviousSimpleConferenceOptions.microphoneAvailable to availableMicButton.toString(),
115+
AuviousSimpleConferenceOptions.speakerAvailable to availableSpeakerButton.toString(),
116+
AuviousSimpleConferenceOptions.conferenceBackgroundColor to if (customConferenceBackgroundColor) Color.parseColor("#3366ff").toString() else Color.BLACK.toString()
100117
)
101118
)
102119
activityForResult.launch(AuviousSimpleConferenceActivity.getIntent(this, callOptions))
@@ -161,14 +178,4 @@ class MainActivity : AppCompatActivity() {
161178
ContextCompat.checkSelfPermission(this, it) == PERMISSION_GRANTED
162179
}
163180
}
164-
}
165-
166-
inline fun <reified T : Parcelable> Intent.parcelable(key: String): T? = when {
167-
Build.VERSION.SDK_INT >= 33 -> getParcelableExtra(key, T::class.java)
168-
else -> @Suppress("DEPRECATION") getParcelableExtra(key) as? T
169-
}
170-
171-
inline fun <reified T : Parcelable> Bundle.parcelable(key: String): T? = when {
172-
Build.VERSION.SDK_INT >= 33 -> getParcelable(key, T::class.java)
173-
else -> @Suppress("DEPRECATION") getParcelable(key) as? T
174181
}

0 commit comments

Comments
 (0)