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 download big videos ? #83

Open
OlostA777 opened this issue Oct 23, 2018 · 0 comments
Open

How to download big videos ? #83

OlostA777 opened this issue Oct 23, 2018 · 0 comments

Comments

@OlostA777
Copy link

OlostA777 commented Oct 23, 2018

I would like to add a button in my app that can download the video just filmed. I use that code, but something is missing as it stops (it works perfectly for the little one or 2 seconds videos.

@IBAction func onSavingBtnClicked(_ sender: Any) {
      let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
       let originPath = path.appending("/\(lastFileName)")
     var test:Int = 0
    let alert = UIAlertView();
      alert.message = "Saving: \(lastFileName)";
      alert.addButton(withTitle: "Ok")
      alert.show()

      self.mCamera.downloadFile(fileName: lastFileName, destFilePath: originPath, success:
          {
              downloadTask in
              self.testLbl.text = String(describing: downloadTask.downloadedBytes)
      } , fail: {
          error in
          
          let alert = UIAlertView();
          alert.message = error as? String;
          alert.addButton(withTitle: "Ko")
          alert.show()
      }); 
      }
  }

Should I have to use URLSession ? But I don't really know how to use it.
=> I don't know how to use that:

 mCamera.urlSession(<#T##session: URLSession##URLSession#>, downloadTask: downloadTask, didWriteData: downloadTask.downloadedBytes, totalBytesWritten: downloadTask.downloadedBytes, totalBytesExpectedToWrite: downloadTask.totalBytes)
//

Thanks in advance.

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