Search code examples
video-capturemediastoreandroid

MediaStore.ACTION_VIDEO_CAPTURE issuewith HTC desire


I am attempting to use the MediaStore.ACTION_VIDEO_CAPTURE in my app, see code below. However, there seems to be an issue with it on the HTC desire. When the video capture intent launches, everything is fine, but as soon as the round button for record is pressed, or any of the UI interacted with in fact, the intent hangs. Logcat doesn't throw any errors, but whenever I attempt to interact with the phone it posts " UI Block". I am able to quit the application with the home button, but after this the camera is unaccessable, the app cannot rund on the phone again -untill the device has been reset. Ive tried the app on a HTC sensation where it worked without problems. I think it might be an issue with the HTC Sense UI, but I am not sure. Code as follows:

case R.id.VCF_Btn_record: Intent captureVideoIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); startActivityForResult(captureVideoIntent, VIDEO_CAPTURED);

MediaStore is API level 1, and ACTION_VIDEO_CAPTURE API lvl 3, so it should work on this device, has anyone else experienced anything similar?


Solution

  • Here is the code that I'm using in my app, which works perfectly fine on my Desire:

    private void captureVideo() {
        Intent i = new Intent("android.media.action.VIDEO_CAPTURE");
        try {
            startActivityForResult(i, CAPTURE_VIDEO);
        } catch (ActivityNotFoundException ex) {
            Toast.makeText(this, "Your device does not contain an application to run this action", Toast.LENGTH_LONG).show();
        }
    }
    

    I know that android.provider.MediaStore.ACTION_VIDEO_CAPTURE resolves to "android.media.action.VIDEO_CAPTURE", but if I recall when developing my app, using it didn't work for me.

    See if that works for you