Я использую CameraKit, и я могу сфотографировать его, но я не знаю, как записать видео. Я ищу в документации, и я нашел событие и два метода для запуска и остановки видео, я ищу в FFMPEG, и я не смог реализовать, если есть какое-либо решение, пожалуйста, помогите мне.
cameraKitView.captureVideo(VideoCallback callback)
cameraKitView.startVideo()
cameraKitView.stopVideo()
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn_capture = findViewById(R.id.btn_capture);
cameraKitView = findViewById(R.id.camera);
// btn_capture.setOnClickListener(photoOnClickListener);
btn_capture.setOnClickListener(videoOnClickListener);
}
private View.OnClickListener videoOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
cameraKitView.captureVideo(new CameraKitView.VideoCallback() {
@Override
public void onVideo(final CameraKitView cameraKitView, final Object o) {
cameraKitView.startVideo();
cameraKitView.postDelayed(new Runnable() {
@Override
public void run() {
//cameraKitView.stopVideo();
Toast.makeText(MainActivity.this, "video stoped", Toast.LENGTH_SHORT).show();
}
}, 2500);
}
};
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.camerakit.CameraKitView
android:id="@+id/camera"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"/>
<Button
android:id="@+id/btn_capture"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="bottom|center"
android:layout_marginBottom="20dp"
android:background="@drawable/rounded_button"
android:padding="15dp" />
<Button
android:id="@+id/btn_settings"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="bottom"
android:layout_marginLeft="34dp"
android:layout_marginBottom="37dp"
android:background="@drawable/ic_settings"
/>
</FrameLayout>