Skip to content

Seeing the preview while streaming #1379

Closed Answered by pedroSG94
maxgrrs asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

When I first integrated the preview, it did not work because the Camera was blocked.
It is only working when the RtmpCamera2 instance is not instanciated (outcommented).

This is because RtmpCamera2 already contain a camera instance and you can't use 2 cameras instances at the same time.
You need to use camera from RtmpCamera2 instead of CameraPreview with ProcessCameraProvider.
For example:

class MainActivity : ComponentActivity(), ConnectChecker {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            val rtmpCamera2 = RtmpCamera2(LocalContext.current, true, this)
            MyApplicationTheme {
    …

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@maxgrrs
Comment options

Answer selected by maxgrrs
Comment options

You must be logged in to vote
1 reply
@maxgrrs
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants