限制用户仅以代号1录制视频3秒

时间:2016-06-03 07:33:19

标签: java codenameone

我需要用codename one用户录制的视频。但我想限制用户不要录制长度超过3 seconds的视频。

录制后有没有办法剪切视频,或者我可以在3秒后停止录制。

2 个答案:

答案 0 :(得分:1)

我在另一个线程上发现了这个,但尚未体验过,但这可能会对你有帮助。

Media = MediaManager.createMediaRecorder("filename.xyz", MediaManager.getMediaRecorderingMimeType());
Button doneButton = new Button("DONE");

doneButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
            stopRecord(false);
        }
    });

   public void stopRecord(boolean timeElapsed)
   {
       answertiming.cancel();
       media.pause();
       media.cleanup();
       if(timeElapsed)
            Dialog.show("SUCCESS","Your time is up system has saved your answer, The file path for the recording is " + p, "OK",null);
       else
            Dialog.show("SUCCESS","You have successfully answered the question System has saved your answer, The file path for the recording is " + p, "OK",null);
   }

我现在的方法是在这个f.e。

周围放置一个3秒的计时器
UITimer timer = new UITimer(new Runnable() {
            @Override
            public void run() {
                 stopreRecord(true);
});
timer.schedule(3000, false, f);

答案 1 :(得分:0)

目前无法在Codename One中实现这一目标,除了使用本机接口功能与本机操作系统集成http://www.codenameone.com/how-do-i---access-native-device-functionality-invoke-native-interfaces.html