有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

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

我需要录制的视频从用户在codename one我与此完成。但我想限制用户不录制长度超过3 seconds的视频

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


共 (2) 个答案

  1. # 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);