如何在代号一中按下按钮后自动开始视频录制并在预定义的时间后自动停止?
How to automatically start video recording and stop automatically after a predefined time in Codename One after pressing a button?
这是我正在尝试的代码,它工作正常,但用户必须按下相机的录制按钮,然后停止录制视频,然后再次按下完成按钮才能成功保存视频。录音自动开始,但必须手动停止。有什么方法可以在录制特定时间(比如 30 秒)后自动执行此操作(停止录制并保存 video/audio)?
protected void onMain_MainButtonAction(组件 c,ActionEvent 事件){
//Capture Video
String Video = Capture.captureVideo();
if(Video != null) {
try {
//Capture Audio
String Audio = Capture.captureAudio();
if(Audio != null) {
try {
//Uploading to the Server
} catch (Exception e) {
Dialog.show("Error!", "Unable to upload Video and Audio to the Server.", "OK", null);
e.printStackTrace();
}
}
else {
Dialog.show("Error!", "Unable to record Audio.", "OK", null);
}
} catch (Exception e) {
e.printStackTrace();
}
}
else {
Dialog.show("Error!", "Unable to record Video.", "OK", null);
}
}
Capture
API 不支持。对于录音,我们有一个录音机 API,它允许我们对音频捕获进行细粒度控制。我们目前没有这样的视频录制控件,但我认为 正在努力。
我们一直致力于改进 z-ordering of peer components 这将使许多以前存在问题的用例(例如增强现实)变得更加实用。所以这可能是我们在前进时将添加到代号一中的东西,尽管我没有即时的预计到达时间。
这是我正在尝试的代码,它工作正常,但用户必须按下相机的录制按钮,然后停止录制视频,然后再次按下完成按钮才能成功保存视频。录音自动开始,但必须手动停止。有什么方法可以在录制特定时间(比如 30 秒)后自动执行此操作(停止录制并保存 video/audio)?
protected void onMain_MainButtonAction(组件 c,ActionEvent 事件){
//Capture Video
String Video = Capture.captureVideo();
if(Video != null) {
try {
//Capture Audio
String Audio = Capture.captureAudio();
if(Audio != null) {
try {
//Uploading to the Server
} catch (Exception e) {
Dialog.show("Error!", "Unable to upload Video and Audio to the Server.", "OK", null);
e.printStackTrace();
}
}
else {
Dialog.show("Error!", "Unable to record Audio.", "OK", null);
}
} catch (Exception e) {
e.printStackTrace();
}
}
else {
Dialog.show("Error!", "Unable to record Video.", "OK", null);
}
}
Capture
API 不支持。对于录音,我们有一个录音机 API,它允许我们对音频捕获进行细粒度控制。我们目前没有这样的视频录制控件,但我认为
我们一直致力于改进 z-ordering of peer components 这将使许多以前存在问题的用例(例如增强现实)变得更加实用。所以这可能是我们在前进时将添加到代号一中的东西,尽管我没有即时的预计到达时间。