diff --git a/FishjamClient/src/main/java/org/membraneframework/rtc/InternalMembraneRTC.kt b/FishjamClient/src/main/java/org/membraneframework/rtc/InternalMembraneRTC.kt index dd2ac82..42a3312 100644 --- a/FishjamClient/src/main/java/org/membraneframework/rtc/InternalMembraneRTC.kt +++ b/FishjamClient/src/main/java/org/membraneframework/rtc/InternalMembraneRTC.kt @@ -6,6 +6,7 @@ import com.fishjamdev.client.BuildConfig import kotlinx.coroutines.* import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock +import org.membraneframework.rtc.error.MembraneError import org.membraneframework.rtc.events.OfferData import org.membraneframework.rtc.media.* import org.membraneframework.rtc.models.EncodingReason @@ -229,13 +230,14 @@ internal class InternalMembraneRTC( fun updateTrackMetadata( trackId: String, trackMetadata: Metadata - ) { - if (localTracksReady[trackId] != true) return + ): Result { + if (localTracksReady[trackId] != true) return Result.failure(Exception(MembraneError.TRACK_NOT_READY.message)) coroutineScope.launch { rtcEngineCommunication.updateTrackMetadata(trackId, trackMetadata) localEndpoint = localEndpoint.withTrack(trackId, trackMetadata) } + return Result.success(Unit) } override fun onConnected( diff --git a/FishjamClient/src/main/java/org/membraneframework/rtc/error/MembraneError.kt b/FishjamClient/src/main/java/org/membraneframework/rtc/error/MembraneError.kt new file mode 100644 index 0000000..d992155 --- /dev/null +++ b/FishjamClient/src/main/java/org/membraneframework/rtc/error/MembraneError.kt @@ -0,0 +1,5 @@ +package org.membraneframework.rtc.error + +enum class MembraneError(val message: String) { + TRACK_NOT_READY("Track was not confirmed by backed. Try again later"), +} \ No newline at end of file