Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use CameraKit with video capture? #619

Open
halilozel1903 opened this issue Nov 2, 2020 · 1 comment
Open

How to use CameraKit with video capture? #619

halilozel1903 opened this issue Nov 2, 2020 · 1 comment

Comments

@halilozel1903
Copy link

halilozel1903 commented Nov 2, 2020

Hi,

I want to use CameraKit with Video Capture but I didn't found Document.

I added activity_camera.xml. Can I do taking a video like photo ?

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".CameraActivity">


    <com.camerakit.CameraKitView
        android:id="@+id/camera"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:adjustViewBounds="true"
        android:keepScreenOn="true"
        app:camera_facing="front"
        app:camera_focus="auto"
        app:camera_permissions="camera"
        tools:ignore="MissingConstraints"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="70dp">

        <Button
            android:text="Record"
            android:id="@+id/btnRecord"
            android:layout_gravity="bottom|center"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </com.camerakit.CameraKitView>

</androidx.constraintlayout.widget.ConstraintLayout>
import android.content.res.Configuration
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.camerakit.CameraKitView
import kotlinx.android.synthetic.main.activity_camera.*


class CameraActivity : AppCompatActivity() {

     var cameraKitView: CameraKitView? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_camera)


        btnRecord.setOnClickListener{

            cameraKitView!!.startVideo()

        }

    }

    override fun onStart() {
        super.onStart()
        camera.onStart()
    }

    override fun onResume() {
        super.onResume()
        camera.onResume()
    }

    override fun onPause() {
        camera.onPause()
        super.onPause()
    }

    override fun onStop() {
        camera.onStop()
        super.onStop()
    }

    override fun onRequestPermissionsResult(
        requestCode: Int,
        permissions: Array<out String>,
        grantResults: IntArray
    ) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)
        camera.onRequestPermissionsResult(requestCode, permissions, grantResults)
    }

    override fun onConfigurationChanged(newConfig: Configuration) {
        super.onConfigurationChanged(newConfig)
    }
}

Can you help me?

@Rajsekhar355
Copy link

Can you help its not starting video capture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants