diff --git a/app/src/main/java/org/linphone/core/CorePreferences.kt b/app/src/main/java/org/linphone/core/CorePreferences.kt index 4b2bdb07b..b959ba8f0 100644 --- a/app/src/main/java/org/linphone/core/CorePreferences.kt +++ b/app/src/main/java/org/linphone/core/CorePreferences.kt @@ -119,6 +119,13 @@ class CorePreferences config.setBool("app", "route_audio_to_speaker_when_video_enabled", value) } + @get:WorkerThread @set:WorkerThread + var callRecordingUseSmffFormat: Boolean + get() = config.getBool("app", "use_smff_for_call_recording", false) + set(value) { + config.setBool("app", "use_smff_for_call_recording", value) + } + @get:WorkerThread @set:WorkerThread var automaticallyStartCallRecording: Boolean get() = config.getBool("app", "auto_start_call_record", false) diff --git a/app/src/main/java/org/linphone/ui/main/recordings/viewmodel/RecordingMediaPlayerViewModel.kt b/app/src/main/java/org/linphone/ui/main/recordings/viewmodel/RecordingMediaPlayerViewModel.kt index 4d4bfa87b..b025be769 100644 --- a/app/src/main/java/org/linphone/ui/main/recordings/viewmodel/RecordingMediaPlayerViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/recordings/viewmodel/RecordingMediaPlayerViewModel.kt @@ -38,6 +38,7 @@ import org.linphone.core.tools.Log import org.linphone.ui.GenericViewModel import org.linphone.ui.main.recordings.model.RecordingModel import org.linphone.utils.AudioUtils +import org.linphone.utils.LinphoneUtils class RecordingMediaPlayerViewModel @UiThread @@ -56,6 +57,8 @@ class RecordingMediaPlayerViewModel val position = MutableLiveData() + val isUsingSmffFileFormat = MutableLiveData() + private var audioFocusRequest: AudioFocusRequestCompat? = null private val playerListener = PlayerListener { @@ -88,6 +91,7 @@ class RecordingMediaPlayerViewModel recordingModel = model coreContext.postOnCoreThread { core -> + isUsingSmffFileFormat.postValue(model.filePath.endsWith(LinphoneUtils.RECORDING_SMFF_FILE_EXTENSION)) initPlayer() } } diff --git a/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt b/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt index 1da989a84..aab34bdbb 100644 --- a/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt @@ -197,6 +197,7 @@ class SettingsViewModel // Advanced settings val startAtBoot = MutableLiveData() val keepAliveThirdPartyAccountsService = MutableLiveData() + val useSmffForCallRecording = MutableLiveData() val deviceName = MutableLiveData() val fileSharingServerUrl = MutableLiveData() @@ -300,6 +301,7 @@ class SettingsViewModel videoFecEnabled.postValue(core.isFecEnabled) vibrateDuringIncomingCall.postValue(core.isVibrationOnIncomingCallEnabled) autoRecordCalls.postValue(corePreferences.automaticallyStartCallRecording) + useSmffForCallRecording.postValue(corePreferences.callRecordingUseSmffFormat) useWifiOnly.postValue(core.isWifiOnlyEnabled) allowIpv6.postValue(core.isIpv6Enabled) @@ -428,6 +430,15 @@ class SettingsViewModel } } + @UiThread + fun toggleUseSmffForCallRecording() { + val newValue = useSmffForCallRecording.value == false + coreContext.postOnCoreThread { core -> + corePreferences.callRecordingUseSmffFormat = newValue + useSmffForCallRecording.postValue(newValue) + } + } + @UiThread fun toggleVibrateOnIncomingCalls() { val newValue = vibrateDuringIncomingCall.value == false diff --git a/app/src/main/java/org/linphone/utils/LinphoneUtils.kt b/app/src/main/java/org/linphone/utils/LinphoneUtils.kt index 5ee6aae33..1b6249dd8 100644 --- a/app/src/main/java/org/linphone/utils/LinphoneUtils.kt +++ b/app/src/main/java/org/linphone/utils/LinphoneUtils.kt @@ -61,7 +61,8 @@ class LinphoneUtils { const val RECORDING_FILE_NAME_HEADER = "call_recording_" const val RECORDING_FILE_NAME_URI_TIMESTAMP_SEPARATOR = "_on_" - const val RECORDING_FILE_EXTENSION = ".smff" + const val RECORDING_MKV_FILE_EXTENSION = ".mkv" + const val RECORDING_SMFF_FILE_EXTENSION = ".smff" @WorkerThread fun getDefaultAccount(): Account? { @@ -451,7 +452,13 @@ class LinphoneUtils { @WorkerThread fun getRecordingFilePathForAddress(address: Address): String { - val fileName = "${RECORDING_FILE_NAME_HEADER}${address.asStringUriOnly()}${RECORDING_FILE_NAME_URI_TIMESTAMP_SEPARATOR}${System.currentTimeMillis()}$RECORDING_FILE_EXTENSION" + val extension = if (corePreferences.callRecordingUseSmffFormat) { + RECORDING_SMFF_FILE_EXTENSION + } else { + RECORDING_MKV_FILE_EXTENSION + } + Log.i("$TAG Using [$extension] file format for call recording") + val fileName = "${RECORDING_FILE_NAME_HEADER}${address.asStringUriOnly()}${RECORDING_FILE_NAME_URI_TIMESTAMP_SEPARATOR}${System.currentTimeMillis()}$extension" return FileUtils.getFileStoragePath(fileName, isRecording = true).absolutePath } diff --git a/app/src/main/res/layout/recording_player_fragment.xml b/app/src/main/res/layout/recording_player_fragment.xml index 49717b335..3db49e36a 100644 --- a/app/src/main/res/layout/recording_player_fragment.xml +++ b/app/src/main/res/layout/recording_player_fragment.xml @@ -162,7 +162,7 @@ android:padding="15dp" android:src="@drawable/share_network" android:contentDescription="@string/content_description_share_file" - android:visibility="gone" + android:visibility="@{viewModel.isUsingSmffFileFormat ? View.GONE : View.VISIBLE}" app:tint="@color/gray_main2_500" app:layout_constraintEnd_toStartOf="@id/save" app:layout_constraintTop_toTopOf="parent" /> @@ -176,7 +176,7 @@ android:padding="15dp" android:src="@drawable/download_simple" android:contentDescription="@string/content_description_save_file" - android:visibility="gone" + android:visibility="@{viewModel.isUsingSmffFileFormat ? View.GONE : View.VISIBLE}" app:tint="@color/gray_main2_500" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/settings_advanced_fragment.xml b/app/src/main/res/layout/settings_advanced_fragment.xml index 2e73f3555..c250f9221 100644 --- a/app/src/main/res/layout/settings_advanced_fragment.xml +++ b/app/src/main/res/layout/settings_advanced_fragment.xml @@ -145,6 +145,50 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@id/keep_alive_service_switch" /> + + + + + + + app:layout_constraintTop_toBottomOf="@id/use_smff_call_recording_switch"/> Nom de l\'appareil Caractères alpha-numériques uniquement URL du serveur de partage de fichier + Enregistrer les appels vidéos utilisant H265/AV1 + Utilisera un format de fichier propriétaire Chiffrement du média Rendre le chiffrement du média obligatoire Créer en mode chiffré de bout en bout les réunions et les appels de groupe diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6abd1cfae..f39509dd2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -307,6 +307,8 @@ Device ID Alpha-numerical characters only File sharing server URL + Record video calls using H265/AV1 + Will use a proprietary file format Media encryption Media encryption mandatory Create end-to-end encrypted meetings & group calls