Pre-Existing Threads on this issue
- Streaming Music Hitch iOS
- Help With WWW GetAudioClip Freeze Please
- Multithreaded Web Requests In iOS
- External Audio Freeze
- Loading Screen Freeze
- Unity Freeze With OGV Streaming
- Problems Playing Audio For Streaming Video
So I’ve seen lots of other posts on the forum about this, and I was hoping this would be solved in Unity 5, but has anyone found a workaround or solution to this problem?
To summarize, the www GetAudioClip() function hitches when a stream is finished loading from the web, after accessing the www audioclip property (I assume that’s the moment when the bytes are transformed into an AudioClip). This hitch can completely freeze a device for multiple seconds, making it near unusable in a finished project.
According to my research, there are a few possible things to investigate to get around this bug, although I haven’t tested them myself yet, I’ll update this post if/when I do…
LoadLevelAdditive
Use LoadLevelAdditive to try to get the audio to stream from a background thread. Although this functionality wasn’t multi-threaded in Unity 4, so I’m not sure if this would solve the problem in Unity 5.
Investigate UniTunes and Veemix
Investigate how unity Asset Store assets apparently got an www audio stream to load SoundCloud music without hitching. This would involve delving into their assets and hoping that their code is accessible and that the solution is usable to normal Unity development.
UPDATE: Veemix responded in this thread, I’ve tested out his code solution with no change in performance.
UPDATE: I also integrated UniTunes into my application and I can confirm first hand that it works without a lag spike. Unfortunately UniTunes is only used for Sound Cloud links (MPEG) and not all AudioTypes. However the logic used to play the clips still uses AudioClip and is worth exploring further.
Only Allow Constant Bit Rate Files
Only allow audio files with a constant bit rate, which according to the linked thread, may possibly improve performance, although later posts say this doesn’t work.
I sent an email out to the original poster that said constant bit rate files should fix this. I’ll be testing this solution.
UPDATE: I tested the constant bit rate solution, and found that this had no change in performance.
Does anyone have any experience with this bug, or has anyone found a work around?

