I use image_picker record video, But I want to limit the time of the video

前端 未结 2 476
面向向阳花
面向向阳花 2021-01-07 01:02

I developed video recording using image_picker. We need to limit video recording time.

pubspec.yaml dependencies: image_picker: ^0.4.10

[f         


        
2条回答
  •  孤独总比滥情好
    2021-01-07 01:45

    The camera recording is launched using an intent on Android (ACTION_VIDEO_CAPTURE) and a UIModal in ios. It's not a plugins that's customizable to your needs it only does what it's intended too. The activity and the UIModal UI is built for that purpose. The best way to do what you want to do is:

    1. To create your own plugin and add a timer in the class that triggers after recoring. When timer finishes just stop and save the recording and return to the previous view. You can see how it's done here on Android for Flutter then just look at iOS and do the same. It should only be a few additional lines of code.

    2. Modify the current plugin to fit your needs, this shouldn't be this difficult. It won't be something that they would want to merge back into the code because it's not a feature most of the users of this library would need so no pull request would be made for that, but you can keep it on your own github and share it. The code is here. Just keep in mind you'd have to maintain it yourself, even though there won't be much change in here.

提交回复
热议问题