-
Notifications
You must be signed in to change notification settings - Fork 56
Replace Twilio's AudioSwitch library with a custom implementation #1591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop-v2
Are you sure you want to change the base?
Changes from all commits
1b7340a
4117310
e766ee4
4c6b87a
4b0850e
7a9db52
1dceba7
c0d1fad
4470d33
68729cd
9285dc9
381e5f5
03290e1
9c38908
92a4f54
ba59411
a57c887
f22d2dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8503,85 +8503,79 @@ public abstract interface class io/getstream/video/android/core/api/SignalServer | |
| } | ||
|
|
||
| public abstract interface class io/getstream/video/android/core/audio/AudioHandler { | ||
| public abstract fun selectDevice (Lio/getstream/video/android/core/audio/StreamAudioDevice;)V | ||
| public abstract fun start ()V | ||
| public abstract fun stop ()V | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check git history for AudioHandler
echo "=== Checking git history for AudioHandler.kt ==="
git log --oneline --all -- "**/AudioHandler.kt" 2>/dev/null | head -20 || echo "No git history found"
echo ""
echo "=== Searching for AudioHandler implementations ==="
rg "implements AudioHandler|: AudioHandler" -t kotlin -t java 2>/dev/null || echo "No implementations found"
echo ""
echo "=== Checking for AudioHandler interface definition ==="
fd "AudioHandler.kt" -x cat {} \;Repository: GetStream/stream-video-android Length of output: 6657 Correct API signature for The 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| public final class io/getstream/video/android/core/audio/AudioSwitchHandler : io/getstream/video/android/core/audio/AudioHandler { | ||
| public static final field Companion Lio/getstream/video/android/core/audio/AudioSwitchHandler$Companion; | ||
| public fun <init> (Landroid/content/Context;Ljava/util/List;Lkotlin/jvm/functions/Function2;)V | ||
| public final fun selectDevice (Lcom/twilio/audioswitch/AudioDevice;)V | ||
| public fun start ()V | ||
| public fun stop ()V | ||
| } | ||
|
|
||
| public final class io/getstream/video/android/core/audio/AudioSwitchHandler$Companion { | ||
| } | ||
|
|
||
| public abstract class io/getstream/video/android/core/audio/StreamAudioDevice { | ||
| public static final field Companion Lio/getstream/video/android/core/audio/StreamAudioDevice$Companion; | ||
| public static final fun fromAudio (Lcom/twilio/audioswitch/AudioDevice;)Lio/getstream/video/android/core/audio/StreamAudioDevice; | ||
| public abstract fun getAudio ()Lcom/twilio/audioswitch/AudioDevice; | ||
| public static final fun fromAudioDeviceInfo (Landroid/media/AudioDeviceInfo;)Lio/getstream/video/android/core/audio/StreamAudioDevice; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can see several breaking changes. If we have decided to move forward with this approach, I suggest we draft a migration document to help developers transition to the newer APIs. |
||
| public abstract fun getAudioDeviceInfo ()Landroid/media/AudioDeviceInfo; | ||
| public abstract fun getName ()Ljava/lang/String; | ||
| public static final fun toAudioDevice (Lio/getstream/video/android/core/audio/StreamAudioDevice;)Lcom/twilio/audioswitch/AudioDevice; | ||
| public static final fun toAudioDeviceInfo (Lio/getstream/video/android/core/audio/StreamAudioDevice;Landroid/media/AudioManager;)Landroid/media/AudioDeviceInfo; | ||
| } | ||
|
|
||
| public final class io/getstream/video/android/core/audio/StreamAudioDevice$BluetoothHeadset : io/getstream/video/android/core/audio/StreamAudioDevice { | ||
| public fun <init> (Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;)V | ||
| public synthetic fun <init> (Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;ILkotlin/jvm/internal/DefaultConstructorMarker;)V | ||
| public fun <init> ()V | ||
| public fun <init> (Ljava/lang/String;Landroid/media/AudioDeviceInfo;)V | ||
| public synthetic fun <init> (Ljava/lang/String;Landroid/media/AudioDeviceInfo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V | ||
| public final fun component1 ()Ljava/lang/String; | ||
| public final fun component2 ()Lcom/twilio/audioswitch/AudioDevice; | ||
| public final fun copy (Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;)Lio/getstream/video/android/core/audio/StreamAudioDevice$BluetoothHeadset; | ||
| public static synthetic fun copy$default (Lio/getstream/video/android/core/audio/StreamAudioDevice$BluetoothHeadset;Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;ILjava/lang/Object;)Lio/getstream/video/android/core/audio/StreamAudioDevice$BluetoothHeadset; | ||
| public final fun component2 ()Landroid/media/AudioDeviceInfo; | ||
| public final fun copy (Ljava/lang/String;Landroid/media/AudioDeviceInfo;)Lio/getstream/video/android/core/audio/StreamAudioDevice$BluetoothHeadset; | ||
| public static synthetic fun copy$default (Lio/getstream/video/android/core/audio/StreamAudioDevice$BluetoothHeadset;Ljava/lang/String;Landroid/media/AudioDeviceInfo;ILjava/lang/Object;)Lio/getstream/video/android/core/audio/StreamAudioDevice$BluetoothHeadset; | ||
| public fun equals (Ljava/lang/Object;)Z | ||
| public fun getAudio ()Lcom/twilio/audioswitch/AudioDevice; | ||
| public fun getAudioDeviceInfo ()Landroid/media/AudioDeviceInfo; | ||
| public fun getName ()Ljava/lang/String; | ||
| public fun hashCode ()I | ||
| public fun toString ()Ljava/lang/String; | ||
| } | ||
|
|
||
| public final class io/getstream/video/android/core/audio/StreamAudioDevice$Companion { | ||
| public final fun fromAudio (Lcom/twilio/audioswitch/AudioDevice;)Lio/getstream/video/android/core/audio/StreamAudioDevice; | ||
| public final fun toAudioDevice (Lio/getstream/video/android/core/audio/StreamAudioDevice;)Lcom/twilio/audioswitch/AudioDevice; | ||
| public final fun fromAudioDeviceInfo (Landroid/media/AudioDeviceInfo;)Lio/getstream/video/android/core/audio/StreamAudioDevice; | ||
| public final fun toAudioDeviceInfo (Lio/getstream/video/android/core/audio/StreamAudioDevice;Landroid/media/AudioManager;)Landroid/media/AudioDeviceInfo; | ||
| } | ||
|
|
||
| public final class io/getstream/video/android/core/audio/StreamAudioDevice$Earpiece : io/getstream/video/android/core/audio/StreamAudioDevice { | ||
| public fun <init> (Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;)V | ||
| public synthetic fun <init> (Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;ILkotlin/jvm/internal/DefaultConstructorMarker;)V | ||
| public fun <init> ()V | ||
| public fun <init> (Ljava/lang/String;Landroid/media/AudioDeviceInfo;)V | ||
| public synthetic fun <init> (Ljava/lang/String;Landroid/media/AudioDeviceInfo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V | ||
| public final fun component1 ()Ljava/lang/String; | ||
| public final fun component2 ()Lcom/twilio/audioswitch/AudioDevice; | ||
| public final fun copy (Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;)Lio/getstream/video/android/core/audio/StreamAudioDevice$Earpiece; | ||
| public static synthetic fun copy$default (Lio/getstream/video/android/core/audio/StreamAudioDevice$Earpiece;Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;ILjava/lang/Object;)Lio/getstream/video/android/core/audio/StreamAudioDevice$Earpiece; | ||
| public final fun component2 ()Landroid/media/AudioDeviceInfo; | ||
| public final fun copy (Ljava/lang/String;Landroid/media/AudioDeviceInfo;)Lio/getstream/video/android/core/audio/StreamAudioDevice$Earpiece; | ||
| public static synthetic fun copy$default (Lio/getstream/video/android/core/audio/StreamAudioDevice$Earpiece;Ljava/lang/String;Landroid/media/AudioDeviceInfo;ILjava/lang/Object;)Lio/getstream/video/android/core/audio/StreamAudioDevice$Earpiece; | ||
| public fun equals (Ljava/lang/Object;)Z | ||
| public fun getAudio ()Lcom/twilio/audioswitch/AudioDevice; | ||
| public fun getAudioDeviceInfo ()Landroid/media/AudioDeviceInfo; | ||
| public fun getName ()Ljava/lang/String; | ||
| public fun hashCode ()I | ||
| public fun toString ()Ljava/lang/String; | ||
| } | ||
|
|
||
| public final class io/getstream/video/android/core/audio/StreamAudioDevice$Speakerphone : io/getstream/video/android/core/audio/StreamAudioDevice { | ||
| public fun <init> (Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;)V | ||
| public synthetic fun <init> (Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;ILkotlin/jvm/internal/DefaultConstructorMarker;)V | ||
| public fun <init> ()V | ||
| public fun <init> (Ljava/lang/String;Landroid/media/AudioDeviceInfo;)V | ||
| public synthetic fun <init> (Ljava/lang/String;Landroid/media/AudioDeviceInfo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V | ||
| public final fun component1 ()Ljava/lang/String; | ||
| public final fun component2 ()Lcom/twilio/audioswitch/AudioDevice; | ||
| public final fun copy (Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;)Lio/getstream/video/android/core/audio/StreamAudioDevice$Speakerphone; | ||
| public static synthetic fun copy$default (Lio/getstream/video/android/core/audio/StreamAudioDevice$Speakerphone;Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;ILjava/lang/Object;)Lio/getstream/video/android/core/audio/StreamAudioDevice$Speakerphone; | ||
| public final fun component2 ()Landroid/media/AudioDeviceInfo; | ||
| public final fun copy (Ljava/lang/String;Landroid/media/AudioDeviceInfo;)Lio/getstream/video/android/core/audio/StreamAudioDevice$Speakerphone; | ||
| public static synthetic fun copy$default (Lio/getstream/video/android/core/audio/StreamAudioDevice$Speakerphone;Ljava/lang/String;Landroid/media/AudioDeviceInfo;ILjava/lang/Object;)Lio/getstream/video/android/core/audio/StreamAudioDevice$Speakerphone; | ||
| public fun equals (Ljava/lang/Object;)Z | ||
| public fun getAudio ()Lcom/twilio/audioswitch/AudioDevice; | ||
| public fun getAudioDeviceInfo ()Landroid/media/AudioDeviceInfo; | ||
| public fun getName ()Ljava/lang/String; | ||
| public fun hashCode ()I | ||
| public fun toString ()Ljava/lang/String; | ||
| } | ||
|
|
||
| public final class io/getstream/video/android/core/audio/StreamAudioDevice$WiredHeadset : io/getstream/video/android/core/audio/StreamAudioDevice { | ||
| public fun <init> (Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;)V | ||
| public synthetic fun <init> (Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;ILkotlin/jvm/internal/DefaultConstructorMarker;)V | ||
| public fun <init> ()V | ||
| public fun <init> (Ljava/lang/String;Landroid/media/AudioDeviceInfo;)V | ||
| public synthetic fun <init> (Ljava/lang/String;Landroid/media/AudioDeviceInfo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V | ||
| public final fun component1 ()Ljava/lang/String; | ||
| public final fun component2 ()Lcom/twilio/audioswitch/AudioDevice; | ||
| public final fun copy (Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;)Lio/getstream/video/android/core/audio/StreamAudioDevice$WiredHeadset; | ||
| public static synthetic fun copy$default (Lio/getstream/video/android/core/audio/StreamAudioDevice$WiredHeadset;Ljava/lang/String;Lcom/twilio/audioswitch/AudioDevice;ILjava/lang/Object;)Lio/getstream/video/android/core/audio/StreamAudioDevice$WiredHeadset; | ||
| public final fun component2 ()Landroid/media/AudioDeviceInfo; | ||
| public final fun copy (Ljava/lang/String;Landroid/media/AudioDeviceInfo;)Lio/getstream/video/android/core/audio/StreamAudioDevice$WiredHeadset; | ||
| public static synthetic fun copy$default (Lio/getstream/video/android/core/audio/StreamAudioDevice$WiredHeadset;Ljava/lang/String;Landroid/media/AudioDeviceInfo;ILjava/lang/Object;)Lio/getstream/video/android/core/audio/StreamAudioDevice$WiredHeadset; | ||
| public fun equals (Ljava/lang/Object;)Z | ||
| public fun getAudio ()Lcom/twilio/audioswitch/AudioDevice; | ||
| public fun getAudioDeviceInfo ()Landroid/media/AudioDeviceInfo; | ||
| public fun getName ()Ljava/lang/String; | ||
| public fun hashCode ()I | ||
| public fun toString ()Ljava/lang/String; | ||
|
|
@@ -8812,17 +8806,6 @@ public final class io/getstream/video/android/core/call/state/Reaction : io/gets | |
| public fun toString ()Ljava/lang/String; | ||
| } | ||
|
|
||
| public final class io/getstream/video/android/core/call/state/SelectAudioDevice : io/getstream/video/android/core/call/state/CallAction { | ||
| public fun <init> (Lcom/twilio/audioswitch/AudioDevice;)V | ||
| public final fun component1 ()Lcom/twilio/audioswitch/AudioDevice; | ||
| public final fun copy (Lcom/twilio/audioswitch/AudioDevice;)Lio/getstream/video/android/core/call/state/SelectAudioDevice; | ||
| public static synthetic fun copy$default (Lio/getstream/video/android/core/call/state/SelectAudioDevice;Lcom/twilio/audioswitch/AudioDevice;ILjava/lang/Object;)Lio/getstream/video/android/core/call/state/SelectAudioDevice; | ||
| public fun equals (Ljava/lang/Object;)Z | ||
| public final fun getAudioDevice ()Lcom/twilio/audioswitch/AudioDevice; | ||
| public fun hashCode ()I | ||
| public fun toString ()Ljava/lang/String; | ||
| } | ||
|
|
||
| public final class io/getstream/video/android/core/call/state/Settings : io/getstream/video/android/core/call/state/CallAction { | ||
| public fun <init> (Z)V | ||
| public final fun component1 ()Z | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,7 +26,9 @@ | |||||||||||||
|
|
||||||||||||||
| <uses-permission android:name="android.permission.INTERNET" /> | ||||||||||||||
| <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||||||||||||||
| <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> | ||||||||||||||
| <!-- Bluetooth permissions: BLUETOOTH for API < 31, BLUETOOTH_CONNECT for API 31+ --> | ||||||||||||||
| <uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" /> | ||||||||||||||
| <!-- <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />--> | ||||||||||||||
|
Comment on lines
+29
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing BLUETOOTH_CONNECT permission for API 31+. The comment states that 🔎 Proposed fix <!-- Bluetooth permissions: BLUETOOTH for API < 31, BLUETOOTH_CONNECT for API 31+ -->
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
-<!-- <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />-->
+ <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> | ||||||||||||||
| <uses-permission android:name="android.permission.VIBRATE" /> | ||||||||||||||
| <uses-permission android:name="android.permission.RECORD_AUDIO" /> | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused
isSelectedvariable creates selection bug whenaudioDeviceInfois null.The
isSelectedvariable (lines 221-252) implements proper fallback logic for whenaudioDeviceInfois null, but it's never used. Line 257 uses a direct ID comparison that returnsfalsewhen either device lacks anaudioDeviceInfo, breaking selection highlighting for the Twilio AudioSwitch path whereaudioDeviceInfocan be null.🔎 Proposed fix - use the computed isSelected
AudioDeviceUiState( it, it.name, icon, - it.audioDeviceInfo?.id == selectedMicroPhoneDevice?.audioDeviceInfo?.id, + isSelected, )