Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
add error
Browse files Browse the repository at this point in the history
  • Loading branch information
karkakol committed Jun 13, 2024
1 parent 3318d48 commit 247a939
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -229,13 +230,14 @@ internal class InternalMembraneRTC(
fun updateTrackMetadata(
trackId: String,
trackMetadata: Metadata
) {
if (localTracksReady[trackId] != true) return
): Result<Unit> {
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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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"),
}

0 comments on commit 247a939

Please sign in to comment.