Hello, I have the following error, maybe any of you guys can help me
when I try to download a mp4 file with unity www class it failed with only “aborted” error message in www.error
its a weird error, it only appear on some devices, I have tried it on galaxy note 5 and works well, and when some one have tried it on a galaxy s7, he get that error
any one mybe know what is hapening?
Thanks for your help guys.
The code to download the video
private IEnumerator DownloadVideo()
{showDownloadProgress = true; downloadProgress.gameObject.SetActive(true);
videoURL = MainPlayerCTRL.mediaURL; Uri uri = new Uri(videoURL); string filename = System.IO.Path.GetFileName(uri.LocalPath); string localFilePath = Application.persistentDataPath + "/"+ filename; bool tryVideoDownload = true;
if (!File.Exists(localFilePath)) { while (tryVideoDownload) { downloadProgressText.text = "Downloading"; showDownloadProgress = true; downloadProgress.gameObject.SetActive(true);
www = new WWW(videoURL); yield return www; if (String.IsNullOrEmpty(www.error)) { byte[] bytes = www.bytes; FileStream fs = new FileStream(localFilePath, FileMode.Create); fs.Write(bytes, 0, bytes.Length); downloadProgressText.text = "Download done!"; yield return new WaitForSeconds(2); tryVideoDownload = false; }//Video downloaded else { showDownloadProgress = false; downloadProgress.gameObject.SetActive(true); downloadProgressText.text = "Download ERROR \n "; downloadProgressText.text += www.error; yield return new WaitForSeconds(2); downloadProgressText.text = "Attempting to download again"; yield return new WaitForSeconds(2); tryVideoDownload = true; } }
yield return new WaitForEndOfFrame(); }
}