question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Video recording fails to save to file

See original GitHub issue

stopVideoRecording() always returns false, with no error

  private var tmpVideoFile: File? = null

  @SuppressLint("SimpleDateFormat")
  @Throws(IOException::class)
  private fun getNewVideoFile(): File {
    // Create an image file name
    val timeStamp: String = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date())
    val directory = "${Environment.getExternalStorageDirectory().absolutePath}/filmit/videos".also { File(it).mkdirs() }
    return File(directory, "$timeStamp.mp4")
  }

  @SuppressLint("MissingPermission")
  private fun listenToVideoRecordEvent() {
    publisherDisposable = videoRecordEventPublisher.subscribe {
      if (it) {
        recordVideoFrame.visibility = View.VISIBLE
        tmpVideoFile = getNewVideoFile()
        recordVideoCamera.startVideoRecording(tmpVideoFile!!) {
          // Configure video (MediaRecorder) parameters
          audioEncoder = AudioEncoder.Aac
          videoFrameRate = 60
          videoStabilization = true
          videoEncoder = VideoEncoder.H263
        }
      } else {
        if(recordVideoCamera.stopVideoRecording()) {
          uploadTmpVideo()
        } else {
          Log.e(TAG, "failed to save video to file")
          Log.d(TAG, tmpVideoFile.toString())
        }
        recordVideoFrame.visibility = View.GONE
      }
    }

  }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
prajapatiravi257commented, Jan 9, 2019

No error is thrown even after logging

0reactions
pvasacommented, Jan 16, 2019

It seems, on certain devices, the library is falling back to camera1 implementation and thus could not start video recording (not supported on camera1). Implementing video recording on camera1 might be a future enhancement. In regards with this issue, the library functions as designed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Camera App Failed to Save Video File - Microsoft Community
I tried to see if I could change where the files are stored, but it's already set to a valid location: "C:\".
Read more >
Screen Recording Failed to Save Due to Failed to ... - YouTube
How to fix Screen Recording failed to save due to failed to save screen recording in iOS 13, ... Your browser can't play...
Read more >
What to Do if Screen Recording Failed to Save?
How to fix “Screen Recording failed to save” · Solution 1. Check For Screen Recording Restrictions · Solution 2. Update iOS version ·...
Read more >
How To Fix Screen Recording Failed Errors due to 5823 ...
If you don't have enough storage space the recording won't be saved and will result in a failed attempt.
Read more >
Recording failed to save at the end - CamStudio
I downloaded VirtualDub and when I tried to import the video file, I got an error message that "The file "c:\users\Kevin\Desktop\Documentor.avi" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found