David Zhao

Added audio modes docs to README

driveby: updated callback types
@@ -10,21 +10,21 @@ @@ -10,21 +10,21 @@
10 10
11 <!--BEGIN_DESCRIPTION-->Use this SDK to add real-time video, audio and data features to your Android/Kotlin app. By connecting to a self- or cloud-hosted <a href="https://livekit.io/">LiveKit</a> server, you can quickly build applications like interactive live streaming or video calls with just a few lines of code.<!--END_DESCRIPTION--> 11 <!--BEGIN_DESCRIPTION-->Use this SDK to add real-time video, audio and data features to your Android/Kotlin app. By connecting to a self- or cloud-hosted <a href="https://livekit.io/">LiveKit</a> server, you can quickly build applications like interactive live streaming or video calls with just a few lines of code.<!--END_DESCRIPTION-->
12 12
13 -Table of Contents  
14 -=================  
15 -  
16 - * [Docs](#docs)  
17 - * [Installation](#installation)  
18 - * [Usage](#usage)  
19 - * [Permissions](#permissions)  
20 - * [Publishing camera and microphone](#publishing-camera-and-microphone)  
21 - * [Sharing screen](#sharing-screen)  
22 - * [Rendering subscribed tracks](#rendering-subscribed-tracks)  
23 - * [@FlowObservable](#flowobservable)  
24 - * [Sample App](#sample-app)  
25 - * [Dev Environment](#dev-environment)  
26 - * [Optional (Dev convenience)](#optional-dev-convenience)  
27 - 13 +# Table of Contents
  14 +
  15 +- [Docs](#docs)
  16 +- [Installation](#installation)
  17 +- [Usage](#usage)
  18 + - [Permissions](#permissions)
  19 + - [Publishing camera and microphone](#publishing-camera-and-microphone)
  20 + - [Sharing screen](#sharing-screen)
  21 + - [Rendering subscribed tracks](#rendering-subscribed-tracks)
  22 + - [Audio modes](#audio-modes)
  23 + - [@FlowObservable](#flowobservable)
  24 +- [Sample App](#sample-app)
  25 +- [Dev Environment](#dev-environment)
  26 + - [Optional (Dev convenience)](#optional-dev-convenience)
  27 +
28 ## Docs 28 ## Docs
29 29
30 Docs and guides at [https://docs.livekit.io](https://docs.livekit.io). 30 Docs and guides at [https://docs.livekit.io](https://docs.livekit.io).
@@ -55,7 +55,7 @@ subprojects { @@ -55,7 +55,7 @@ subprojects {
55 mavenCentral() 55 mavenCentral()
56 // ... 56 // ...
57 maven { url 'https://jitpack.io' } 57 maven { url 'https://jitpack.io' }
58 - 58 +
59 // For SNAPSHOT access 59 // For SNAPSHOT access
60 // maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' } 60 // maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
61 } 61 }
@@ -172,6 +172,24 @@ See @@ -172,6 +172,24 @@ See
172 the [basic sample app](https://github.com/livekit/client-sdk-android/blob/main/sample-app-basic/src/main/java/io/livekit/android/sample/basic/MainActivity.kt) 172 the [basic sample app](https://github.com/livekit/client-sdk-android/blob/main/sample-app-basic/src/main/java/io/livekit/android/sample/basic/MainActivity.kt)
173 for the full implementation. 173 for the full implementation.
174 174
  175 +### Audio modes
  176 +
  177 +WebRTC utilizes an audio module to interface with the device's audio input and output. By default, the audio module is configured for two-way communications.
  178 +
  179 +If you are building a livestreaming or music app, you can make the following tweaks to improve playback quality:
  180 +
  181 +```kt
  182 +WebRTCModuleOptions options = WebRTCModuleOptions.getInstance();
  183 +AudioDeviceModule adm = JavaAudioDeviceModule.builder(this)
  184 + .setAudioAttributes(AudioAttributes.Builder()
  185 + .setUsage(AudioAttributes.USAGE_MEDIA)
  186 + .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
  187 + .build())
  188 + .setUseStereoOutput(true)
  189 + .build();
  190 +options.audioDeviceModule = adm;
  191 +```
  192 +
175 ### `@FlowObservable` 193 ### `@FlowObservable`
176 194
177 Properties marked with `@FlowObservable` can be accessed as a Kotlin Flow to observe changes 195 Properties marked with `@FlowObservable` can be accessed as a Kotlin Flow to observe changes
@@ -195,8 +213,8 @@ connect to a room, publish your device's audio/video, and display the video of o @@ -195,8 +213,8 @@ connect to a room, publish your device's audio/video, and display the video of o
195 213
196 There are two more full featured video conferencing sample apps: 214 There are two more full featured video conferencing sample apps:
197 215
198 -* [Compose app](https://github.com/livekit/client-sdk-android/tree/main/sample-app-compose/src/main/java/io/livekit/android/composesample)  
199 -* [Standard app](https://github.com/livekit/client-sdk-android/tree/main/sample-app/src/main/java/io/livekit/android/sample) 216 +- [Compose app](https://github.com/livekit/client-sdk-android/tree/main/sample-app-compose/src/main/java/io/livekit/android/composesample)
  217 +- [Standard app](https://github.com/livekit/client-sdk-android/tree/main/sample-app/src/main/java/io/livekit/android/sample)
200 218
201 They both use 219 They both use
202 the [`CallViewModel`](https://github.com/livekit/client-sdk-android/blob/main/sample-app-common/src/main/java/io/livekit/android/sample/CallViewModel.kt) 220 the [`CallViewModel`](https://github.com/livekit/client-sdk-android/blob/main/sample-app-common/src/main/java/io/livekit/android/sample/CallViewModel.kt)
@@ -206,8 +224,8 @@ app. @@ -206,8 +224,8 @@ app.
206 The respective `ParticipantItem` class in each app is responsible for the displaying of each 224 The respective `ParticipantItem` class in each app is responsible for the displaying of each
207 participant's UI. 225 participant's UI.
208 226
209 -* [Compose `ParticipantItem`](https://github.com/livekit/client-sdk-android/blob/main/sample-app-compose/src/main/java/io/livekit/android/composesample/ParticipantItem.kt)  
210 -* [Standard `ParticipantItem`](https://github.com/livekit/client-sdk-android/blob/main/sample-app/src/main/java/io/livekit/android/sample/ParticipantItem.kt) 227 +- [Compose `ParticipantItem`](https://github.com/livekit/client-sdk-android/blob/main/sample-app-compose/src/main/java/io/livekit/android/composesample/ParticipantItem.kt)
  228 +- [Standard `ParticipantItem`](https://github.com/livekit/client-sdk-android/blob/main/sample-app/src/main/java/io/livekit/android/sample/ParticipantItem.kt)
211 229
212 ## Dev Environment 230 ## Dev Environment
213 231
@@ -222,7 +240,7 @@ cd client-sdk-android @@ -222,7 +240,7 @@ cd client-sdk-android
222 git submodule update --init 240 git submodule update --init
223 ``` 241 ```
224 242
225 ----- 243 +---
226 244
227 For those developing on Apple M1 Macs, please add below to $HOME/.gradle/gradle.properties 245 For those developing on Apple M1 Macs, please add below to $HOME/.gradle/gradle.properties
228 246
@@ -236,7 +254,9 @@ protoc_platform=osx-x86_64 @@ -236,7 +254,9 @@ protoc_platform=osx-x86_64
236 2. Add sources to Android Studio by pointing at the `webrtc/sdk/android` folder. 254 2. Add sources to Android Studio by pointing at the `webrtc/sdk/android` folder.
237 255
238 <!--BEGIN_REPO_NAV--> 256 <!--BEGIN_REPO_NAV-->
  257 +
239 <br/><table> 258 <br/><table>
  259 +
240 <thead><tr><th colspan="2">LiveKit Ecosystem</th></tr></thead> 260 <thead><tr><th colspan="2">LiveKit Ecosystem</th></tr></thead>
241 <tbody> 261 <tbody>
242 <tr><td>Client SDKs</td><td><a href="https://github.com/livekit/components-js">Components</a> · <a href="https://github.com/livekit/client-sdk-js">JavaScript</a> · <a href="https://github.com/livekit/client-sdk-swift">iOS/macOS</a> · <b>Android</b> · <a href="https://github.com/livekit/client-sdk-flutter">Flutter</a> · <a href="https://github.com/livekit/client-sdk-react-native">React Native</a> · <a href="https://github.com/livekit/client-sdk-rust">Rust</a> · <a href="https://github.com/livekit/client-sdk-python">Python</a> · <a href="https://github.com/livekit/client-sdk-unity-web">Unity (web)</a> · <a href="https://github.com/livekit/client-sdk-unity">Unity (beta)</a></td></tr><tr></tr> 262 <tr><td>Client SDKs</td><td><a href="https://github.com/livekit/components-js">Components</a> · <a href="https://github.com/livekit/client-sdk-js">JavaScript</a> · <a href="https://github.com/livekit/client-sdk-swift">iOS/macOS</a> · <b>Android</b> · <a href="https://github.com/livekit/client-sdk-flutter">Flutter</a> · <a href="https://github.com/livekit/client-sdk-react-native">React Native</a> · <a href="https://github.com/livekit/client-sdk-rust">Rust</a> · <a href="https://github.com/livekit/client-sdk-python">Python</a> · <a href="https://github.com/livekit/client-sdk-unity-web">Unity (web)</a> · <a href="https://github.com/livekit/client-sdk-unity">Unity (beta)</a></td></tr><tr></tr>
@@ -1053,12 +1053,12 @@ interface RoomListener { @@ -1053,12 +1053,12 @@ interface RoomListener {
1053 * When a new track is published to room after the local participant has joined. It will 1053 * When a new track is published to room after the local participant has joined. It will
1054 * not fire for tracks that are already published 1054 * not fire for tracks that are already published
1055 */ 1055 */
1056 - fun onTrackPublished(publication: TrackPublication, participant: RemoteParticipant, room: Room) {} 1056 + fun onTrackPublished(publication: RemoteTrackPublication, participant: RemoteParticipant, room: Room) {}
1057 1057
1058 /** 1058 /**
1059 * A [RemoteParticipant] has unpublished a track 1059 * A [RemoteParticipant] has unpublished a track
1060 */ 1060 */
1061 - fun onTrackUnpublished(publication: TrackPublication, participant: RemoteParticipant, room: Room) {} 1061 + fun onTrackUnpublished(publication: RemoteTrackPublication, participant: RemoteParticipant, room: Room) {}
1062 1062
1063 /** 1063 /**
1064 * When a new track is published to room after the local participant has joined. 1064 * When a new track is published to room after the local participant has joined.