Skip to content

Commit

Permalink
fix(lib): fix exception on startPreview
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Sep 30, 2024
1 parent d8d3d5d commit 99d4f9a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,11 @@ constructor(
Log.w(TAG, "Video config is not set")
return@permissionRequester
}
apiVideoView.startPreview()
try {
apiVideoView.startPreview()
} catch (t: Throwable) {
Log.e(TAG, "Can't start preview: ${t.message}")
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package video.api.livestream.views

import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.ViewGroup
import android.widget.FrameLayout
import io.github.thibaultbee.streampack.core.streamers.interfaces.ICameraStreamer
Expand All @@ -25,7 +26,11 @@ class ApiVideoView @JvmOverloads constructor(
* @param value the [ICameraStreamer] to use
*/
set(value) {
previewView.streamer = value
try {
previewView.streamer = value
} catch (t: Throwable) {
Log.w(TAG, "Failed to set streamer: $t")
}
}

init {
Expand Down Expand Up @@ -61,4 +66,8 @@ class ApiVideoView @JvmOverloads constructor(
internal fun startPreview() {
previewView.startPreview()
}

companion object {
private const val TAG = "ApiVideoView"
}
}

0 comments on commit 99d4f9a

Please sign in to comment.