【发布时间】:2016-11-23 14:56:59
【问题描述】:
我有以下错误
当我尝试下载带有统一 www 类的 mp4 文件时,它失败了,在 www.error 中只有“中止”错误消息
这是一个奇怪的错误,它只出现在某些设备上,我已经在 Galaxy Note 5 上尝试过并且效果很好,当有人在 Galaxy s7 上尝试过时,他得到了这个错误
任何人都知道什么是hapening?
感谢你们的帮助。
下载视频的代码
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();
}
}
【问题讨论】:
-
视频有多大?另外,它失败的设备型号是什么?这很可能是内存问题。在不知道所有这些信息的情况下还不确定。
-
视频大小为 250 mb,您认为可能是临时内存问题?智能手机的内部和外部存储空间超过 2GB。
-
Internal and External storage!=Ram。人们混淆了这两者。我曾经遇到过这个问题,并为它写了一个解决方案。如果我在我的电脑上找到它会给出答案。 -
是的,我知道区别,我的意思是,如果您认为问题可能是(内存)或内部/外部存储问题
-
哦,好的。没明白。很有可能是公羊。大约一个小时后回来查看这个问题。