Hi all
I have problem with streaming music from StreamingAssets folder. I need this for custom player soundtracks. It takes much memory.
I did some testing (10 ogg files - total 61,3MB) of uncompressed loading and streaming.
![1]
(“Empty” means empty project with no audio and “Inside” means audio files inside Assets folder)
Memory is changing when streaming around ± 20MB
Streaming from StreamingAssets (what I need) takes such memory.
And there is another problem which other not have. When streaming music 1, play next music and then play music 1 again, it is not playing! Only silence.
I storing clips on array of AudioClip called clips.
Here is my loading code
IEnumerator LoadAllClips(bool streaming)
{
//... more code
// Request to our file on HDD
WWW request = new WWW("file:///" + filePath);
yield return StartCoroutine(WaitForRequest(request));
// Get audio clip and rename it
AudioClip clip = request.GetAudioClip(true, streaming);
clip.name = fileName;
// Add to array
clips *= clip;*
// … more code
}
I can store only file paths and doing WWW requests runtime. But it will be more work and more complicated.
Is there a better way?
(btw: forum gives me “Your content can not be submitted. error”)
*