How to limit audio recording time using Intent?

前端 未结 4 1219
青春惊慌失措
青春惊慌失措 2021-02-19 00:47

How can I limit recording when using intents?

I tried this code:

 Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
 intent.putExtra(\"android         


        
4条回答
  •  别跟我提以往
    2021-02-19 01:53

    I Have a similar problem and I fixed my problem using below code snippet:

    Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
    cameraIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 5);
    startActivityForResult(this, cameraIntent,CAMERA_PIC_REQUEST);
    

    where CAMERA_PIC_REQUEST is my int type as:

    private static final int CAMERA_PIC_REQUEST = 1337;
    

提交回复
热议问题