Skip to content

Commit 57621fd

Browse files
authored
Merge branch 'main' into dl/session_api
2 parents e70835c + ce166ab commit 57621fd

File tree

15 files changed

+169
-70
lines changed

15 files changed

+169
-70
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"client-sdk-android": patch
3+
---
4+
5+
Fixed camera indicator remaining on after network disconnection by disposing orphaned tracks from failed reconnection attempts (#296)

.changeset/nasty-kids-fail.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.changeset/sixty-baboons-yawn.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/tough-rings-unite.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# client-sdk-android
22

3+
## 2.22.0
4+
5+
### Minor Changes
6+
7+
- Extract CameraXProvider and expose it. - [#754](https://github.com/livekit/client-sdk-android/pull/754) ([@KasemJaffer](https://github.com/KasemJaffer))
8+
9+
### Patch Changes
10+
11+
- Fix camera lookup to check physicalId - [#792](https://github.com/livekit/client-sdk-android/pull/792) ([@KasemJaffer](https://github.com/KasemJaffer))
12+
13+
## 2.21.1
14+
15+
### Patch Changes
16+
17+
- #721 Fixed publisher negotiation race condition causing ICE timeouts. - [#789](https://github.com/livekit/client-sdk-android/pull/789) ([@adrian-niculescu](https://github.com/adrian-niculescu))
18+
19+
## 2.21.0
20+
21+
### Minor Changes
22+
23+
- End to end encryption for data channels option - [#762](https://github.com/livekit/client-sdk-android/pull/762) ([@davidliu](https://github.com/davidliu))
24+
25+
- Added EncryptionType fields to DataReceived events and StreamInfo objects to indicate the
26+
encryption status.
27+
28+
- Add TokenSource implementation for use with token servers - [#769](https://github.com/livekit/client-sdk-android/pull/769) ([@davidliu](https://github.com/davidliu))
29+
30+
### Patch Changes
31+
32+
- Increase RPC method max roundtrip time to 7s - [#775](https://github.com/livekit/client-sdk-android/pull/775) ([@davidliu](https://github.com/davidliu))
33+
334
## 2.20.3
435

536
### Patch Changes

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ LiveKit for Android is available as a Maven package.
4747
```groovy title="build.gradle"
4848
...
4949
dependencies {
50-
def livekit_version = "2.20.3"
50+
def livekit_version = "2.22.0"
5151
5252
implementation "io.livekit:livekit-android:$livekit_version"
5353
@@ -58,7 +58,7 @@ dependencies {
5858
implementation "io.livekit:livekit-android-track-processors:$livekit_version"
5959
6060
// Snapshots of the latest development version are available at:
61-
// implementation "io.livekit:livekit-android:2.20.4-SNAPSHOT"
61+
// implementation "io.livekit:livekit-android:2.22.1-SNAPSHOT"
6262
}
6363
```
6464

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ kotlin.code.style=official
2323
###############################################################
2424

2525
GROUP=io.livekit
26-
VERSION_NAME=2.20.4-SNAPSHOT
26+
VERSION_NAME=2.22.0
2727

2828
POM_DESCRIPTION=LiveKit Android SDK, WebRTC Rooms
2929

livekit-android-camerax/src/main/java/livekit/org/webrtc/CameraXHelper.kt

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,11 @@
1616

1717
package livekit.org.webrtc
1818

19-
import android.content.Context
2019
import android.hardware.camera2.CameraManager
2120
import androidx.camera.camera2.interop.ExperimentalCamera2Interop
2221
import androidx.camera.core.UseCase
23-
import androidx.lifecycle.Lifecycle
2422
import androidx.lifecycle.LifecycleOwner
25-
import io.livekit.android.room.track.LocalVideoTrackOptions
2623
import io.livekit.android.room.track.video.CameraCapturerUtils
27-
import io.livekit.android.room.track.video.CameraCapturerUtils.findCamera
28-
import io.livekit.android.room.track.video.CameraEventsDispatchHandler
2924

3025
class CameraXHelper {
3126
companion object {
@@ -44,41 +39,9 @@ class CameraXHelper {
4439
fun createCameraProvider(
4540
lifecycleOwner: LifecycleOwner,
4641
useCases: Array<out UseCase> = emptyArray(),
47-
) = object : CameraCapturerUtils.CameraProvider {
48-
49-
private var enumerator: CameraXEnumerator? = null
50-
51-
override val cameraVersion = 3
52-
53-
override fun provideEnumerator(context: Context): CameraXEnumerator =
54-
enumerator ?: CameraXEnumerator(context, lifecycleOwner, useCases).also {
55-
enumerator = it
56-
}
57-
58-
override fun provideCapturer(
59-
context: Context,
60-
options: LocalVideoTrackOptions,
61-
eventsHandler: CameraEventsDispatchHandler,
62-
): VideoCapturer {
63-
val enumerator = provideEnumerator(context)
64-
val cameraManager = context.getSystemService(Context.CAMERA_SERVICE) as CameraManager
65-
66-
val targetDevice = enumerator.findCamera(options.deviceId, options.position)
67-
val targetDeviceId = targetDevice?.deviceId
68-
69-
val targetVideoCapturer = enumerator.createCapturer(targetDeviceId, eventsHandler) as CameraXCapturer
70-
71-
return CameraXCapturerWithSize(
72-
targetVideoCapturer,
73-
cameraManager,
74-
targetDeviceId,
75-
eventsHandler,
76-
)
77-
}
78-
79-
override fun isSupported(context: Context): Boolean {
80-
return Camera2Enumerator.isSupported(context) && lifecycleOwner.lifecycle.currentState.isAtLeast(Lifecycle.State.INITIALIZED)
81-
}
42+
cameraVersion: Int = 3,
43+
): CameraXProvider {
44+
return CameraXProvider(lifecycleOwner, useCases, cameraVersion)
8245
}
8346

8447
private fun getSupportedFormats(
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Copyright 2025 LiveKit, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package livekit.org.webrtc
18+
19+
import android.content.Context
20+
import android.hardware.camera2.CameraManager
21+
import androidx.camera.camera2.interop.ExperimentalCamera2Interop
22+
import androidx.camera.core.UseCase
23+
import androidx.lifecycle.Lifecycle
24+
import androidx.lifecycle.LifecycleOwner
25+
import io.livekit.android.room.track.LocalVideoTrackOptions
26+
import io.livekit.android.room.track.video.CameraCapturerUtils
27+
import io.livekit.android.room.track.video.CameraCapturerUtils.findCamera
28+
import io.livekit.android.room.track.video.CameraEventsDispatchHandler
29+
30+
@ExperimentalCamera2Interop
31+
class CameraXProvider(
32+
val lifecycleOwner: LifecycleOwner,
33+
val useCases: Array<out UseCase> = emptyArray(),
34+
override val cameraVersion: Int = 3,
35+
) : CameraCapturerUtils.CameraProvider {
36+
37+
var enumerator: CameraXEnumerator? = null
38+
private set
39+
40+
override fun provideEnumerator(context: Context): CameraXEnumerator = enumerator ?: CameraXEnumerator(context, lifecycleOwner, useCases).also {
41+
enumerator = it
42+
}
43+
44+
override fun provideCapturer(
45+
context: Context,
46+
options: LocalVideoTrackOptions,
47+
eventsHandler: CameraEventsDispatchHandler,
48+
): VideoCapturer {
49+
val enumerator = provideEnumerator(context)
50+
val cameraManager = context.getSystemService(Context.CAMERA_SERVICE) as CameraManager
51+
52+
val targetDevice = enumerator.findCamera(options.deviceId, options.position)
53+
val targetDeviceId = targetDevice?.deviceId
54+
55+
val targetVideoCapturer = enumerator.createCapturer(targetDeviceId, eventsHandler) as CameraXCapturer
56+
57+
return CameraXCapturerWithSize(
58+
targetVideoCapturer,
59+
cameraManager,
60+
targetDeviceId,
61+
eventsHandler,
62+
)
63+
}
64+
65+
override fun isSupported(context: Context): Boolean {
66+
return Camera2Enumerator.isSupported(context) && lifecycleOwner.lifecycle.currentState.isAtLeast(Lifecycle.State.INITIALIZED)
67+
}
68+
}

livekit-android-camerax/src/main/java/livekit/org/webrtc/CameraXSession.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,12 @@ internal constructor(
167167

168168
// Select camera by ID
169169
val cameraSelector = CameraSelector.Builder()
170-
.addCameraFilter { cameraInfo -> cameraInfo.filter { Camera2CameraInfo.from(it).cameraId == cameraDevice.deviceId } }
170+
.addCameraFilter { cameraInfo ->
171+
cameraInfo.filter {
172+
val cameraId = Camera2CameraInfo.from(it).cameraId
173+
cameraId == cameraDevice.deviceId || cameraId == cameraDevice.physicalId
174+
}
175+
}
171176
.build()
172177

173178
try {
@@ -282,7 +287,10 @@ internal constructor(
282287
}
283288

284289
private fun obtainCameraConfiguration() {
285-
val camera = cameraProvider.availableCameraInfos.map { Camera2CameraInfo.from(it) }.first { it.cameraId == cameraDevice.deviceId }
290+
val camera = cameraProvider.availableCameraInfos.map { Camera2CameraInfo.from(it) }
291+
.first {
292+
it.cameraId == cameraDevice.deviceId || it.cameraId == cameraDevice.physicalId
293+
}
286294

287295
cameraOrientation = camera.getCameraCharacteristic(CameraCharacteristics.SENSOR_ORIENTATION) ?: -1
288296
isCameraFrontFacing = camera.getCameraCharacteristic(CameraCharacteristics.LENS_FACING) == CameraMetadata.LENS_FACING_FRONT

0 commit comments

Comments
 (0)