6

I'm using LG Nexus(6.0). When I have use the camera to capture video using below code.

   Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
   fileUri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO);
    // set video quality
    intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
    intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 30);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); 

I have given its duration limit using below code.

    intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 30);

The camera seems to ignore the duration limit. On any 6.0 device, it does not work. Is there an another way to limit the capture video duration on 6.0 + devices?

Sanjay Bhalani
  • 2,424
  • 18
  • 44
  • I also verified this issue exists only for Google Camera App whose Version is greater than "2.5.052(2005148-30)". Currently, on Play store, Google Camera App version is "3.2.045(2821762-30)" by using this version you can easily reproduce this issue. Previously Google Camera EXTRA_DURATION_LIMIT was working on the V2.5.052. – Sanjay Bhalani Jul 20 '17 at 13:24
  • 1
    any solutions ? – Jithish P N Sep 14 '17 at 12:22

1 Answers1

6

The camera seems to ignore the duration limit. On any 6.0 device it does not work.

There are ~2 billion Android devices, spread across thousands of device models from hundreds of manufacturers. Those devices will have hundreds of different pre-installed camera apps, plus possibly camera apps installed by users. Any of them can be what responds to an ACTION_VIDEO_CAPTURE request, and any of them can have bugs. This issue is not tied to an Android OS version.

Is there a other way to limit the capture video duration on 6.0 + devices?

Not with ACTION_VIDEO_CAPTURE. You are delegating the work to a third-party app, and that app can do whatever it wants.

If you want full control, use MediaRecorder, either directly in your own code or via some third-party library.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I also verified this issue exists only for Google Camera App whose Version is greater than "2.5.052(2005148-30)". Currently, on Play store, Google Camera App version is "3.2.045(2821762-30)" by using this version you can easily reproduce this issue. Previously Google Camera EXTRA_DURATION_LIMIT was working on the V2.5.052. – Sanjay Bhalani Jul 20 '17 at 13:28
  • It looks like no camera app is supporting it anymore unfortunately – Adam Kis Mar 05 '19 at 08:33