Leo Wiki
Leo Wiki

Reputation: 252

"Can't connect to camera" Error while capturing video Android

I'm trying to capture video in my Android project for that, I have written the following code---

Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
            intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
            intent.putExtra(MediaStore.EXTRA_OUTPUT, selectedMediaUri);
            // start the video capture Intent
            startActivityForResult(intent, CAPTURE);

plz see the following screen shot-

enter image description here

Please help me to solve this issue.. Thanks

Upvotes: 2

Views: 699

Answers (2)

buzzingsilently
buzzingsilently

Reputation: 1586

In which device you are testing is important as if you are testing on Marshmallow device you will need to grant permission at run time.

Upvotes: 1

m0aaz
m0aaz

Reputation: 19

did you add the permission?

<uses-permission android:name="android.permission.CAMERA" />

Upvotes: 1

Related Questions