Added support for HDMI devices

This commit is contained in:
Sylvain Berfini 2025-07-03 17:02:41 +02:00
parent be24224f4c
commit 1a54746a80
8 changed files with 30 additions and 2 deletions

View file

@ -126,6 +126,8 @@ class CurrentCallViewModel
val isBluetoothEnabled = MutableLiveData<Boolean>() val isBluetoothEnabled = MutableLiveData<Boolean>()
val isHdmiEnabled = MutableLiveData<Boolean>()
val fullScreenMode = MutableLiveData<Boolean>() val fullScreenMode = MutableLiveData<Boolean>()
val pipMode = MutableLiveData<Boolean>() val pipMode = MutableLiveData<Boolean>()
@ -760,6 +762,9 @@ class CurrentCallViewModel
device.deviceName device.deviceName
) )
} }
AudioDevice.Type.Hdmi -> {
AppUtils.getString(R.string.call_audio_device_type_hdmi)
}
else -> device.deviceName else -> device.deviceName
} }
val isCurrentlyInUse = device.type == currentDevice?.type && device.deviceName == currentDevice.deviceName val isCurrentlyInUse = device.type == currentDevice?.type && device.deviceName == currentDevice.deviceName
@ -781,6 +786,9 @@ class CurrentCallViewModel
AudioDevice.Type.Speaker -> AudioUtils.routeAudioToSpeaker( AudioDevice.Type.Speaker -> AudioUtils.routeAudioToSpeaker(
currentCall currentCall
) )
AudioDevice.Type.Hdmi -> AudioUtils.routeAudioToHdmi(
currentCall
)
else -> AudioUtils.routeAudioToEarpiece(currentCall) else -> AudioUtils.routeAudioToEarpiece(currentCall)
} }
} }
@ -1279,6 +1287,7 @@ class CurrentCallViewModel
) )
isHearingAidEnabled.postValue(audioDevice?.type == AudioDevice.Type.HearingAid) isHearingAidEnabled.postValue(audioDevice?.type == AudioDevice.Type.HearingAid)
isBluetoothEnabled.postValue(audioDevice?.type == AudioDevice.Type.Bluetooth) isBluetoothEnabled.postValue(audioDevice?.type == AudioDevice.Type.Bluetooth)
isHdmiEnabled.postValue(audioDevice?.type == AudioDevice.Type.Hdmi)
updateProximitySensor() updateProximitySensor()
} }

View file

@ -352,6 +352,9 @@ class MeetingWaitingRoomViewModel
device.deviceName device.deviceName
) )
} }
AudioDevice.Type.Hdmi -> {
AppUtils.getString(R.string.call_audio_device_type_hdmi)
}
else -> device.deviceName else -> device.deviceName
} }

View file

@ -63,6 +63,11 @@ class AudioUtils {
) )
} }
@WorkerThread
fun routeAudioToHdmi(call: Call? = null) {
routeAudioTo(call, arrayListOf(AudioDevice.Type.Hdmi))
}
@WorkerThread @WorkerThread
private fun routeAudioTo( private fun routeAudioTo(
call: Call?, call: Call?,

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="256"
android:viewportHeight="256">
<path
android:pathData="M208,40L48,40A24,24 0,0 0,24 64L24,176a24,24 0,0 0,24 24L208,200a24,24 0,0 0,24 -24L232,64A24,24 0,0 0,208 40ZM216,176a8,8 0,0 1,-8 8L48,184a8,8 0,0 1,-8 -8L40,64a8,8 0,0 1,8 -8L208,56a8,8 0,0 1,8 8ZM168,224a8,8 0,0 1,-8 8L96,232a8,8 0,0 1,0 -16h64A8,8 0,0 1,168 224Z"
android:fillColor="#4e6074"/>
</vector>

View file

@ -122,7 +122,7 @@
android:layout_height="@dimen/call_button_size" android:layout_height="@dimen/call_button_size"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:padding="@dimen/call_button_icon_padding" android:padding="@dimen/call_button_icon_padding"
android:src="@{viewModel.isHearingAidEnabled ? @drawable/ear : viewModel.isHeadsetEnabled ? @drawable/headset : viewModel.isBluetoothEnabled ? @drawable/bluetooth : viewModel.isSpeakerEnabled ? @drawable/speaker_high : @drawable/speaker_slash, default=@drawable/speaker_slash}" android:src="@{viewModel.isHdmiEnabled ? @drawable/monitor : viewModel.isHearingAidEnabled ? @drawable/ear : viewModel.isHeadsetEnabled ? @drawable/headset : viewModel.isBluetoothEnabled ? @drawable/bluetooth : viewModel.isSpeakerEnabled ? @drawable/speaker_high : @drawable/speaker_slash, default=@drawable/speaker_slash}"
android:contentDescription="@string/content_description_change_output_audio_device" android:contentDescription="@string/content_description_change_output_audio_device"
android:background="@drawable/in_call_button_background_transparent" android:background="@drawable/in_call_button_background_transparent"
app:tint="@color/in_call_button_tint_color" app:tint="@color/in_call_button_tint_color"

View file

@ -22,7 +22,7 @@
android:textColor="@color/in_call_label_color" android:textColor="@color/in_call_label_color"
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_marginBottom="1dp" android:layout_marginBottom="1dp"
android:drawableEnd="@{model.type == Type.HearingAid ? @drawable/ear : model.type == Type.Speaker ? @drawable/speaker_high : model.type == Type.Bluetooth ? @drawable/bluetooth : model.type == Type.Headphones || model.type == Type.Headset ? @drawable/headset : @drawable/speaker_slash, default=@drawable/speaker_high}" android:drawableEnd="@{model.type == Type.Hdmi ? @drawable/monitor : model.type == Type.HearingAid ? @drawable/ear : model.type == Type.Speaker ? @drawable/speaker_high : model.type == Type.Bluetooth ? @drawable/bluetooth : model.type == Type.Headphones || model.type == Type.Headset ? @drawable/headset : @drawable/speaker_slash, default=@drawable/speaker_high}"
android:drawableTint="@color/in_call_label_color" android:drawableTint="@color/in_call_label_color"
android:checked="@{model.isCurrentlySelected}" android:checked="@{model.isCurrentlySelected}"
app:useMaterialThemeColors="false" app:useMaterialThemeColors="false"

View file

@ -713,6 +713,7 @@
<string name="call_audio_device_type_hearing_aid">Aide auditive (%s)</string> <string name="call_audio_device_type_hearing_aid">Aide auditive (%s)</string>
<string name="call_audio_device_type_headset">Casque</string> <string name="call_audio_device_type_headset">Casque</string>
<string name="call_audio_device_type_headphones">Écouteurs</string> <string name="call_audio_device_type_headphones">Écouteurs</string>
<string name="call_audio_device_type_hdmi">HDMI</string>
<string name="call_stats_audio_title">Audio</string> <string name="call_stats_audio_title">Audio</string>
<string name="call_stats_codec_label">Codec : %s</string> <string name="call_stats_codec_label">Codec : %s</string>

View file

@ -755,6 +755,7 @@
<string name="call_audio_device_type_hearing_aid">Hearing aid (%s)</string> <string name="call_audio_device_type_hearing_aid">Hearing aid (%s)</string>
<string name="call_audio_device_type_headset">Headset</string> <string name="call_audio_device_type_headset">Headset</string>
<string name="call_audio_device_type_headphones">Headphones</string> <string name="call_audio_device_type_headphones">Headphones</string>
<string name="call_audio_device_type_hdmi">HDMI</string>
<string name="call_stats_audio_title">Audio</string> <string name="call_stats_audio_title">Audio</string>
<string name="call_stats_codec_label">Codec: %s</string> <string name="call_stats_codec_label">Codec: %s</string>