Skip to content

How to download big videos ? #83

@OlostA777

Description

@OlostA777

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions