sandrios / sandriosCamera

Easy integration of camera for image and video capturing with Image Picker.
MIT License
187 stars 54 forks source link

Video files can't be played in videoview. #22

Closed janshair closed 7 years ago

janshair commented 7 years ago

I recorded a video and store its path. When i tried to play video using this code(Kotlin), i am getting a dialog that states "Can't Play this video" . Here is my code


             SandriosCamera(parentFragment.activity, REQUEST_IMAGE_CAPTURE)
                                  .setShowPicker(false)
                                  .setVideoFileSize(10) //File Size in MB: Default is no limit
                                  .setMediaAction(CameraConfiguration.MEDIA_ACTION_BOTH) // default is CameraConfiguration.MEDIA_ACTION_BOTH
                                  .enableImageCropping(true) // Default is false.
                                  .launchCamera();

to get path

val path : String = data!!.getStringExtra(CameraConfiguration.Arguments.FILE_PATH)

and to play

      videoView.setVideoPath(path)
        videoView.start()

device-2017-06-28-153139

arpitgandhi9 commented 7 years ago

Uri.fromFile(new File(path))