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

Selecting video file in Fragment #88

Open
Mukhammadjon-Jalolov opened this issue Nov 10, 2023 · 0 comments
Open

Selecting video file in Fragment #88

Mukhammadjon-Jalolov opened this issue Nov 10, 2023 · 0 comments

Comments

@Mukhammadjon-Jalolov
Copy link

I am creating a Fragment in an app which displays this Fullscreen video view. The fragment has a button to open a device directory. Right after selecting a video file I'm creating a file from it in onActivityResult. But when I assign this File to fullscreen-video-view (inside onActivityResult) the app crashes after selecting a video

`override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)

    if(requestCode == 55 && resultCode == Activity.RESULT_OK){
        val myinputstream = requireContext().contentResolver.openInputStream(data?.data!!)
        myVideoFile = File.createTempFile("vid", "vid")

        myinputstream.use { input ->
            myVideoFile.outputStream().use { output ->
                input!!.copyTo(output)
            }
        }
        fullscreenVideoView.videoFile(myVideoFile)  // myVideoFile is declared as **lateinit var myVideoFile: File**  
    }
}`

How to solve this issue? Where should I use fullscreenVideoView.videoFile(myVideoFile) after selecting a file... Thank you for help!

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

1 participant