Added conference recording
This commit is contained in:
parent
0f9f0d8475
commit
3aa1abc72c
2 changed files with 27 additions and 5 deletions
|
@ -37,10 +37,8 @@ import org.linphone.activities.main.dialer.NumpadDigitListener
|
||||||
import org.linphone.compatibility.Compatibility
|
import org.linphone.compatibility.Compatibility
|
||||||
import org.linphone.core.*
|
import org.linphone.core.*
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
import org.linphone.utils.AppUtils
|
import org.linphone.utils.*
|
||||||
import org.linphone.utils.AudioRouteUtils
|
|
||||||
import org.linphone.utils.Event
|
import org.linphone.utils.Event
|
||||||
import org.linphone.utils.PermissionHelper
|
|
||||||
|
|
||||||
class ControlsViewModel : ViewModel() {
|
class ControlsViewModel : ViewModel() {
|
||||||
val isMicrophoneMuted = MutableLiveData<Boolean>()
|
val isMicrophoneMuted = MutableLiveData<Boolean>()
|
||||||
|
@ -335,15 +333,30 @@ class ControlsViewModel : ViewModel() {
|
||||||
|
|
||||||
fun toggleRecording(closeMenu: Boolean) {
|
fun toggleRecording(closeMenu: Boolean) {
|
||||||
somethingClickedEvent.value = Event(true)
|
somethingClickedEvent.value = Event(true)
|
||||||
val currentCall = coreContext.core.currentCall
|
|
||||||
|
val core = coreContext.core
|
||||||
|
val currentCall = core.currentCall
|
||||||
|
val conference = core.conference
|
||||||
|
|
||||||
if (currentCall != null) {
|
if (currentCall != null) {
|
||||||
if (currentCall.isRecording) {
|
if (currentCall.isRecording) {
|
||||||
currentCall.stopRecording()
|
currentCall.stopRecording()
|
||||||
} else {
|
} else {
|
||||||
currentCall.startRecording()
|
currentCall.startRecording()
|
||||||
}
|
}
|
||||||
|
isRecording.value = currentCall.isRecording
|
||||||
|
} else if (conference != null) {
|
||||||
|
val path = LinphoneUtils.getRecordingFilePathForConference()
|
||||||
|
if (conference.isRecording) {
|
||||||
|
conference.stopRecording()
|
||||||
|
} else {
|
||||||
|
conference.startRecording(path)
|
||||||
|
}
|
||||||
|
isRecording.value = conference.isRecording
|
||||||
|
} else {
|
||||||
|
isRecording.value = false
|
||||||
}
|
}
|
||||||
isRecording.value = currentCall?.isRecording
|
|
||||||
if (closeMenu) toggleOptionsMenu()
|
if (closeMenu) toggleOptionsMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,15 @@ class LinphoneUtils {
|
||||||
return FileUtils.getFileStoragePath(fileName).absolutePath
|
return FileUtils.getFileStoragePath(fileName).absolutePath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getRecordingFilePathForConference(): String {
|
||||||
|
val dateFormat: DateFormat = SimpleDateFormat(
|
||||||
|
RECORDING_DATE_PATTERN,
|
||||||
|
Locale.getDefault()
|
||||||
|
)
|
||||||
|
val fileName = "conference_${dateFormat.format(Date())}.mkv"
|
||||||
|
return FileUtils.getFileStoragePath(fileName).absolutePath
|
||||||
|
}
|
||||||
|
|
||||||
fun getRecordingDateFromFileName(name: String): Date {
|
fun getRecordingDateFromFileName(name: String): Date {
|
||||||
return SimpleDateFormat(RECORDING_DATE_PATTERN, Locale.getDefault()).parse(name)
|
return SimpleDateFormat(RECORDING_DATE_PATTERN, Locale.getDefault()).parse(name)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue