I am working on a Unity App being built for iOS and Android devices. In my app I am fetching a url from a web service and that url is for an audio file (.mp3) which I am downloading and saving in the app. Below is code for the same.
if (!File.Exists(audioPath + url.Key + currentDataSetID + FindAudioType(url.Value))){
UnityWebRequest www = new UnityWebRequest("http://www.streetartmankind.org/vuforiadashboard" + url.Value);
// UnityWebRequest www = new UnityWebRequest("http://likewapdownload.com/load/Full_Mp3_Songs/2013_Bollywood_MP3_Songs/ABCD_Any_Body_Can_Dance/Bezubaan.mp3");
www.downloadHandler = new DownloadHandlerFile(audioPath + url.Key +currentDataSetID + FindAudioType(url.Value));
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError){
Debug.Log(www.error);
}
else
{
Debug.Log("Audio Downloaded - " + www.url);
Debug.Log("File successfully downloaded and saved to " + audioPath);
Debug.Log(www.url + "\n" + audioPath + url.Key +
currentDataSetID + FindAudioType(url.Value));
}
}
This code works perfectly in my Android and iPhone devices but on the client's Samsung S9, the audio file is not getting downloaded. Audio file is getting created in S9 but the file size is only around 6 KB while the original audio file is around 5 MB.
Now in the code you can see a url commented out.When I use the commented url then the audio download works in S9 too. So I was suspecting this to be some ip related issue but the client tried on various wifi networks but it didn't worked for him.
So I want to know is this a server issue or an ip issue or a device specific issue.